Skip to content

Comparison Macros#17

Merged
sdcb merged 6 commits intosdcb:masterfrom
zadykian:fix/comparison-macros
Aug 31, 2023
Merged

Comparison Macros#17
sdcb merged 6 commits intosdcb:masterfrom
zadykian:fix/comparison-macros

Conversation

@zadykian
Copy link
Copy Markdown
Contributor

@zadykian zadykian commented Aug 30, 2023

Improved mechanism of values comparison in built-in macros: isEqual, isNotEqual, isLessEqual, isLessThan, isGreaterEqual, isGreaterThan

For instance, previous implementation fails to handle following construct:

#isGreaterThan<DayOfMonth, 1900-01-02, sql {  ,[DayOfMonth]}>
System.InvalidCastException: 'Invalid cast from 'DateTime' to 'Double'.'

See unit tests for more cases

@sdcb sdcb merged commit de91daa into sdcb:master Aug 31, 2023
@zadykian
Copy link
Copy Markdown
Contributor Author

@sdcb, could you also publish sdmap.ext and sdmap.ext.Dapper 0.16.5 to Nuget? Since these two packages depend on base sdmap

@sdcb
Copy link
Copy Markdown
Owner

sdcb commented Sep 1, 2023

I think it will work if install both sdmap.ext.Dapper and sdmap, in theory publish sdmap.ext and sdmap.ext.Dapper isn't necessary, but yes I can publish.

@sdcb
Copy link
Copy Markdown
Owner

sdcb commented Sep 1, 2023

And 1900-01-01 won't work, I think you must use "1900-01-01"(with quotes), can reference following code:

var c = new SdmapCompiler();
c.AddSourceCode("""
sql v1{#isGreaterThan<DayOfMonth, "2023/9/1", sql {  ,[DayOfMonth]}>}
""");
c.Emit("v1", new {DayOfMonth=DateTime.Now}).Dump();
// result:   ,[DayOfMonth]

@zadykian zadykian deleted the fix/comparison-macros branch October 27, 2023 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants