Added
- Added the
Asmethod toclause.TableRef, which sets the alias and return a copy of the struct. (thanks @Nitjsefni7) - Added the
type_systemconfiguration option to determine how to generate null and optional values in the generated code.
Possible options:github.com/aarondl/opt,github.com/aarondl/opt/nullordatabase/sql. The default value isgithub.com/aarondl/opt. - When generating code for queries, The
Allmethod of the generated query will return a struct with nested fields instead of a flat struct.- columns with dots (
.) are assumed to be ato-manynested field. - columns with double underscores (
__) are assumed to be ato-onenested field.
- columns with dots (
- Implement
--prefixannotation in queries forbobgen-psql. - Add FromExisting method to factories to create a template from an existing model. (thanks @dutow)
- Add WithExisting to factory mods to attach an existing model as a relationship. (thanks @dutow)
- Added support in psql for combined args (order by, limit etc.) in combined queries and use parens if they are present. (@iwyrkore)
- Added parens for combined queries. (@iwyrkore)
- Match columns using regular expressions in type replacements. This is useful for e.g. matching columns that have a common prefix or suffix. (thanks @abdusco)
Changed
Modis now a separate field inorm.ModQueryandorm.ModExecQuery.Allxnow takes aTransformertype parameter to transform the result of the query.- Updated documentation for readability, added code gen examples. (thanks @singhsays)
- Columns are now matched in a case-insensitive manner in type replacements. (thanks @abdusco)
- Columns can now be matched with as many conditions as needed in type replacements. This removes the previous requirement that boolean fields had to be specified in addition to a string field. (thanks @abdusco)
- Factories now expose a
NewXWithContextthat accepts a context in addition toNewXthat does not. This provides a cleaner API for the callers, while still allowing the use of context internally. (thanks @abdusco)
Removed
- Removed the
fallback_nullconfiguration option. It is now replaced with thetype_systemconfiguration option.
Fixed
- Fixed some issues with creating relationships in the factory by avoiding trying to reuse models.
- Fix issues with generating code for queries with duplicate return column names.
- Updated gen table detail queries to use context. (thanks @singhsays)
- Properly detect
bool,timestampandtimestamptztypes inbobgen-psql. - Fix transformer for single result queries.
- Properly handle indexes where the sorting order can be null.
- Check for nullability when loading relationships.
- Handle table names quoted with backticks in mysql query parser. (thanks @luiscleto)
- Allow matching columns in type replacements by the
autoincrproperty as stated in the docs. (thanks @abdusco) - Handle dashes and spaces in generated enum values properly (thanks @abdusco)
- Check for nullability when loading relationships from Slices (thanks @felipeparaujo)
New Contributors
- @dutow made their first contribution in #470
- @iwyrkore made their first contribution in #484
- @luiscleto made their first contribution in #493
- @abdusco made their first contribution in #499
Full Changelog: v0.38.0...v0.39.0