v0.43.0
Added
- Added PostgreSQL
MERGEstatement support with full syntax including:MERGE INTO ... USING ... ON ...with table aliases andONLYmodifierWHEN MATCHED,WHEN NOT MATCHED,WHEN NOT MATCHED BY SOURCEclausesUPDATE,INSERT,DELETE,DO NOTHINGactions- Support for
AND conditionin WHEN clauses OVERRIDING SYSTEM VALUEandOVERRIDING USER VALUEfor INSERT actionsRETURNINGclause support (PostgreSQL 17+) (thanks @atzedus)- Note: the SQL parser used for sql-to-code generation does not yet support
MERGEstatements
- Added
psql.SetVersion,psql.GetVersion, andpsql.VersionAtLeastfunctions for context-based PostgreSQL version management (thanks @atzedus) - Added
Table.Merge()method for ORM-style MERGE operations with automaticRETURNING *for PostgreSQL 17+ (thanks @atzedus) - Added
mmpackage with modifiers for building MERGE queries (mm.Into,mm.Using,mm.WhenMatched,mm.WhenNotMatched,mm.WhenNotMatchedBySource, etc.) (thanks @atzedus) - Added
enum_formatconfiguration option to control enum value identifier formatting. Options:"title_case"(default, e.g.,InProgress) or"screaming_snake_case"(e.g.,IN_PROGRESS). - Added
Unqualified()method to generated column structures that returns columns without table alias/prefix. (thanks @atzedus) - Added
PreloadCountandThenLoadCountto generate code for preloading and then loading counts for relationships. (thanks @jacobmolby) - MySQL support for insert queries executing loaders (e.g.,
InsertThenLoad,InsertThenLoadCount). (thanks @jacobmolby) - Added overwritable hooks that are run before the exec or scanning test of generated queries. This allows seeding data before the test runs.
- Added
bob.Eachfunction to iterate over query results (range-over-func). (thanks @toqueteos) - Added support for the
VALUESstatement in MySQL, PostgreSQL, and SQLite. (thanks @manhrev) - Added MariaDB compatibility check in gen/bobgen-mysql (thanks @dumdev25)
- Added
ALL,SOME,ANYexpressions for MySQL and PostgreSQL dialects. AddedEXISTSexpression for all dialects. (thanks @manhrev) - Added a customizable MySQL and PostgreSQL driver image setting for
bobgen-sql. (thanks @manhrev)
Fixed
- Fix
pgxdriverCommit()returningnilinstead ofpgx.ErrTxClosedwhen the transaction is already closed (e.g., rolled back by context expiry). This prevented silent data loss by correctly propagating the error to the caller. (thanks @wucm667) - Fix self-referencing relationship back-references so generated preload/load helpers no longer create cyclic parent links. (thanks @atzedus)
- Fix collisions for preloader alias generation. Replaced
RandIntwithNextUniqueInt(thanks @atzedus) - Fix an issue where the random function of aliased custom types were not being used in generated query tests.
- Properly recognize placeholders in LIMIT and OFFSET when generating queries for PostgreSQL.
- Throw an error on an empty SET clause during SQL generation rather than sending invalid syntax to database. (thanks @Xaeroxe)
- Fix MySQL
Insert().One()/All()/Cursor()usingSELECT *instead of explicit model columns when re-fetching inserted rows, consistent with PostgreSQL/SQLiteRETURNING. (thanks @tak848)
New Contributors
- @olafal0 made their first contribution in #596
- @toqueteos made their first contribution in #607
- @dumdev25 made their first contribution in #614
- @manhrev made their first contribution in #613
- @Xaeroxe made their first contribution in #615
- @aronsx made their first contribution in #630
- @fisayoafolayan made their first contribution in #644
- @Ocyss made their first contribution in #646
- @wucm667 made their first contribution in #661
Full Changelog: v0.42.0...v0.43.0