Generates an ORM based on a postgres database schema
Pending features
Relationship methods: Set, Add, Remove
Find
Exists (by PK)
Usage
DSN=postgres://user:pass@host:port/dbname go run github.com/go-bob/bobgen-psql@latest
About
This is largely based on SQLBoiler, and is currently an experiment for version 5.
Many large scale improvements have been made.
Query building is based on Bob, which is dialect specific and allows for far more possiblites and less bugs.
Composite primary keys and foreign keys are now supported.
qm.Load is entirely reworked.
Loaders are generated specifically for each relation and can be nested to load sub-objects
qm.Load("relationship") is split into PreloadPilotJets and ThenLoadPlotJets. The Preload variants load the relationship in a single call using left joins
while the ThenLoad variants make a new query similar to how the currentl qm.Load works.
All the Column names are now in a single top level variable similar to table names.
Where helpers are in a top level global variables split down into query types. e.g. SelectWhere.Pilot.ID.EQ(10)
Enums types are generated for every enum in the schema, whether or not they were used in a column.
Enums are properly detected even if they are used only as an array.
Nullable types are now just their concrete type with a generic wrapper. Individual null type variants are no longer needed
Inserts and Upserts are not done with the concrete model type, but with an Optional version where every field has to be explicitly set. Removes the need for boil.Infer()
Column lists are generated for every table, which can be filtered with Only or Except and are built to the correctly quoted versions.
Hooks now return a context which will be chained and eventually passed to the query.