Open zepatrik opened 3 years ago
?
is unfortunately reserved for escaped SQL arguments (on a driver level) which makes the proposal difficult to implement. Alternatively, we could expose an interface of "generic" SQL functions such as NOW()
or version
in a common interface which you could use with fmt.Sprintf
. Question is if there is enough overlap in these generic functions to warrant such an interface or if there are really just a few (e.g. NOW()
) where this could be used.
Description
There are some basic build-in SQL functions that are not supported by every database in the same way. One example is the
version()
function. Sqlite does not support it but hassqlite_version()
. Another example isnow()
wich is also not supported by sqlite, instead one has to useCURRENT_TIMESTAMP
there.Expected Behavior
I would like pop to handle these cases for me. One idea I had was to export some constants like
pop.Now
orpop.Version
that one can insert into the query and that would be filled in by the driver accordingly. E.g.:Actual Behavior
Currently I have to do it similar to:
I can work on this if it is desired to have.