My use case is that my database handles specific types much better than others, so I want to force a type for field when querying against it in a reasonable manner (not forcing the user to cast specifically all the time).
Currently I use my own macros for this, but it seems very fragile and I was wondering if korma has facilities to make it easier for me.
The reason I need macros is that korma allows special keyword (like between) in select queries, so I need to transform the select parameters inside the where macro. Maybe there's a nicer way to do it... I'm open to any suggestion :)
Is it possible to transform select field values?
My use case is that my database handles specific types much better than others, so I want to force a type for field when querying against it in a reasonable manner (not forcing the user to cast specifically all the time).
Currently I use my own macros for this, but it seems very fragile and I was wondering if korma has facilities to make it easier for me.
The reason I need macros is that korma allows special keyword (like
between
) in select queries, so I need to transform the select parameters inside thewhere
macro. Maybe there's a nicer way to do it... I'm open to any suggestion :)Here are my macros:
And I use
typed-where
instead ofwhere
if I want to use the recommended field types.