v0.37.0
Highlights
- Nullable columns are no longer generated as
github.com/aarondl/opt/null.Val[T]
, but asdatabase/sql.Null[T]
. - Optional fields (e.g. in setters) are no longer generated as
github.com/aarondl/opt/omit.Val[T]
but as pointers.
Unfortunately, this will require a lot of changes to existing code that depends on the previously generated types.
However, I believe this is a better direction as it uses only the standard library.
Added
- Added the
drivers/pgx
package which contains types and functions to use apgx/v5
connection as abob.Executor
. - Added support for
github.com/ncruces/go-sqlite3
. (thanks @ncruces) - Added support for configuring what type to generate specific null versions of a type instead of always wrapping with
sql.Null[T]
.
Changed
- The
bob.Transaction
interface now takes acontext.Context
argument in theCommit
andRollback
methods. - The method
BeginTx
on thebob.Transaction
interface is now changed toBegin
and it takes a single context argument.
This is to make it easier to implement for nondatabase/sql
drivers. - In the generated model, the
PrimaryKeyVals()
method is now private. - Renamed
driver_name
todriver
in code generation configuration. - In type replacements, nullability is not used in matching.
Previously, nullability of matches was set to false by default, and would require an additional replacement to also match nullable columns.
Removed
- Removed the
New
andNewQueryer
functions. Any ofbob.NewDB
,bob.NewTx
orbob.NewConn
can be used instead. - Removed the
StdInterface
interface as it is unnecessary. - Remove redundant
orm.Model
interface. - Remove dependence on
github.com/aarondl/opt
in generated code.- Nullable values are now wrapped
database/sql.Null
with instead ofgithub.com/aarondl/opt/null.Val
. - Optional values are now represented as pointers instead of
github.com/aarondl/opt/omit.Val[T]
.
- Nullable values are now wrapped
- Removed
in_generated_package
type configuration option. This was limited and could only indicate that the type is in the models package.
Instead the full import path can now be used in theimports
configuration option, and if it is in the same package as the generated code, the prefix will be automatically removed.
Fixed
- Properly handle
nil
args when checking if default or null inmysql
table insert query. - Fix bug in querying slice relationships in MySQL and SQLite.
New Contributors
Full Changelog: v0.36.1...v0.37.0