https://kotlinlang.org logo
#squarelibraries
Title
# squarelibraries
s

s3rius

02/22/2023, 9:21 PM
This is about SQLDelight: Is there a convenient way to generate a couple of default functions for all tables? E.g.
getAll
,
getById(id)
,
deleteById
, etc. I find myself writing them in the sq files for most tables anyway, and that is copy-pasting I'd like to avoid. I know this is predicated on some conditions, like having a atomic
id
property, etc. But again, I find myself writing tables mostly compatible.
d

Darron Schall

02/22/2023, 10:32 PM
The plugin does this for you with code generation and live templates. Right click on a table, then select "Generate" from the popup menu, then pick the option, like "Select By Primary Key", and the plugin automatically generates the
selectById:
query.
s

s3rius

02/23/2023, 5:21 PM
That helps, thanks!
2 Views