Skip to content

Automatic CRUD #1

@tvallotton

Description

@tvallotton

Look into configuring automatic CRUD queries for models. It could generate read/delete/update methods for each unique key in the model, and include both an insert and update query.

Example

codegen:
  crud:
    include: .* # accepts a regex pattern
    exclude:
      - audit_logs

Generated methods for each model:

  • get_by_<unique key>
  • delete_by_<unique key>
  • update_by_<unique key>
  • upsert
  • insert

Btw, this should also probably include bulk inserts, since this is an area where one must usually implement them with json, which removes much of the type safety benefits of pgc.
It is unclear to me if update_by_<unique key> is ever going to be useful given the existence of upsert.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions