drift icon indicating copy to clipboard operation
drift copied to clipboard

Add toJson() for result class

Open andim27 opened this issue 1 year ago • 1 comments

Pleas add if it is possible to generated classes(*.g.dart) .toJson() method class MyTableItemsResult { fields ... toJson(){..return all fields in json format} }

andim27 avatar Jun 24 '24 13:06 andim27

For what do you need json serialization here? You can probably get close to this already by enabling the raw_result_set_data builder option. Then you can use QueryRow.data to get access to the underlying fields.

If you need more complex serialization features, I suggest writing your own data class and then using custom result classes.

simolus3 avatar Jun 24 '24 21:06 simolus3