Search code examples
androidkotlinsqldelight

Update object data with Sqldelight


I am trying to figure out how you would write an Update query in the .sq files where you pass an object and it will update the whole row

I know you can do a normal update statement where you set the columns with the values but is there a way to just pass the data object similar to how I can insert an object like this

insert:
INSERT INTO my_table(id, col1,col2,col3) VALUES ?;

I was unable to find any documentation in updating a record similarly


Solution

  • the only way to do this would be an INSERT OR REPLACE instead of trying it with an update. UPDATE only allows setting columns explicitly, theres no automatic object marshaling