Is there a way to update an object in SqlDelight? ...
# squarelibraries
e
Is there a way to update an object in SqlDelight?
INSERT OR REPLACE
would cause the record to be deleted and reinserted which might trigger foreignkey updates like ON CASCADE DELETE...
k
That's a sqlite limitation...
e
I think it would be great if SQLDelight automatically creates these queries for us in the generated code... So each QueriesInterface would also have additional "utility" methods for inserting and updating models...
a
part of the library philosophy is that we don’t write sql for you. the shorthands are still you writing essentially valid sqlite but with smart type inference
👍 2
e
Do you think is it feasible (I mean in the future) to have some way to allow customization of the sqldelight compiler so that each developer can write his own autogenerated queries?
It's just an idea and I don't know if it can be technically implemented
a
we’d need a lot more traction to warrant building compiler plugins, certainly doable but a lot of work
my own opinion is that this is the right way to handle this case: https://github.com/cashapp/sqldelight/issues/489
👍 1
if you find you’re writing a lot of insert/update/delete statements, we should have the IDE plugin make that easier instead of making the compiler more complex
👍 1
e
An IDE plugin would definitely do the job
525 Views