bobgen-psql

command module
v0.0.0-...-9f89ade Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2022 License: MIT Imports: 10 Imported by: 0

README

Bob Gen for Postgres

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.

  1. Query building is based on Bob, which is dialect specific and allows for far more possiblites and less bugs.
  2. Composite primary keys and foreign keys are now supported.
  3. qm.Load is entirely reworked.
    1. Loaders are generated specifically for each relation and can be nested to load sub-objects
    2. 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.
  4. All the Column names are now in a single top level variable similar to table names.
  5. Where helpers are in a top level global variables split down into query types. e.g. SelectWhere.Pilot.ID.EQ(10)
  6. Enums types are generated for every enum in the schema, whether or not they were used in a column.
  7. Enums are properly detected even if they are used only as an array.
  8. Nullable types are now just their concrete type with a generic wrapper. Individual null type variants are no longer needed
  9. 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()
  10. Column lists are generated for every table, which can be filtered with Only or Except and are built to the correctly quoted versions.
  11. Hooks now return a context which will be chained and eventually passed to the query.
  12. AutoTimestamps are not implemented.
  13. Soft Deletes are not implemented.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL