Currently, the ORM
for V
only supports select
, update
, and insert
. I would like to do a more complicated upsert
like this:
INSERT INTO Settings (Key, Value)
VALUES (?0, ?1)
ON CONFLICT(Key)
DO UPDATE
SET Key = ?0,
Value = ?1;`
But it looks like from the docs there is no exposure for doing an update like this. So, I would need to clean the inserted/updated values myself.
Is there a way to do direct SQL with variables directly? Am I missing something?
Another option I would have would be:
setting := Settings {
key: key
value: value
}
sql r.db {
insert setting into Settings
}
sql r.db {
update Settings set value = value where key == key
}
Although the above works it isn't very elegant and requires two calls to the DB. Is there a way to do direct queries with arguments?