Wulf / dsync

Generate rust structs & query functions from diesel schema files
Other
70 stars 13 forks source link

Add `--readonly-*` options #88

Closed hasezoey closed 11 months ago

hasezoey commented 1 year ago

This PR adds the options --readonly-prefix and --readonly-suffixes to set a table to be read-only. Read-only means to only generate StructType::Read (not Update or Create) and the corresponding functions.

This is useful for things like SQLite's Views which are read-only (can be read, but cannot be written to)

This PR also includes a slight refactor of the generate_for_table function, which now only adds new-lines and struct if they actually have code, resulting in less empty new-lines (which is more apparent with readonly set)

re #56 --read-only-prefix