The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- Update the version constant to prevent inaccurate warnings about the version mismatch
- Add MySQL unix socket support (thanks @c9s)
- Implement (Un-)marshalText for Decimal and NullDecimal (thanks @MJacred)
- Add version checking flags to make sure CLI and project runtime versions are the same (thanks @090809)
- Add SIMILAR TO method for Postgres (thanks @090809)
- Skip code generation for replaced enum types using the flag
--skip-replaced-enum-types
(thanks @MJacred)
- Fix compilation errors with TIMESTAMP columns in sqlite3 driver (thanks @hirasawayuki)
- Fix issue scanning
column_full_type
whencolumn_type
is NULL (thanks @mattdbush) - Fix performance issue with
DeleteAll
by using aWHERE IN
instead ofWHERE OR
(thanks @jakeiotechsys) - Use renamed created column in
Update
method (thanks @glerchundi) - Fix comment position in first column of table (thanks @hizzuu)
- Count from subquery if query uses HAVING or GROUP BY. This is because aggregate functions are run for each group separately, but we need to return the count of returned rows. (thanks @renom)
- Fix output filenames that contain a forward slash or backslash. Replace with an underscore (thanks @MJacred)
- Replace
rand.seed
method to support golang 1.20 (thanks @pbr0ck3r) - Fix issue with invalid template generation on ignored struct tags (thanks @090809)
- Fix an issue caused in the last release where column names were double quoted (thanks @eirikbell)
- Add
Ordinal
function to enum types (thanks @EmiPhil) - Add ability to extend upsert expression with options (thanks @atzedus)
- Add support for different case style for different struct tags (thanks @c9s)
- Improve loads by using maps for deduplication (thanks @nicowolf91)
- Return all columns not in both insert and update columns when doing upsert (thanks @adsa95)
- Composite foreign keys are now ignored to prevent generating invalid code (thanks @paulo-raca)
- Ignore cross-schema foreign keys to prevent invalid code gen (thanks @caleblloyd)
- Fix data race when registring hooks (thanks @nejtr0n)
- Fix types.JSON.MarshalJSON to handle nil values (thanks @agis)
- Properly quote column names in psql upsert (thanks @Flo4604)
- Use aliased field name for
LastInsertID
(thanks @motemen) - Fix panic with nil pointers in structs to bind (thanks @stephenafamo)
- Use
sync.Map
for unique columns to prevent concurrent write and read (thanks @Maxibond)
- Add LIKE and ILIKE Operators (thanks @jerrysalonen)
- Allow defining foreign key relationships in config file (thanks @chrisngyn)
- Fix missing types import on non nullable char column in postgres driver (thanks @Ebbele)
- Fix struct len check for columns whitelist and blacklist in sqlite driver (thanks @oscar-refacton)
- Properly clean name before title casing (thanks @MJacred)
- Fix parsing pgeo point in scientific notation format (thanks @zhongduo)
- Downgrade decimal version before decompose interface (thanks @zhongduo)
- Fix UPSERT query to respect conflict_target in postgres driver (thanks @agis)
- Fix column type conversion in SQLite3 driver, specifically, columns with types such as
FLOAT(2, 1)
orTYNYINT(1)
(thanks @Jumpaku)
- When writing comments, also split comments by
\r
since several dialects also recognise this as a new line character
- Fix qm.WithDeleted helper with a custom soft delete column (thanks @lopezator)
- Skipping empty values from the update list (thanks @bvigar)
- Fix composite key handling in sqlite3 driver (thanks @vortura)
- Use correct executor for relationship test when
no-context
is true
- Allow calling struct.Exists() without having to pass on PK fields (thanks @MJacred)
- Stop using deprecated methods from io/ioutil (thanks @stefafafan)
- Fixed correct hooks when loading relationships to-one (thanks @parnic)
- Generate IN/NIN whereHelpers for nullable types (thanks @fdegiuli)
- Fixed concurrent map writes in psql driver (thanks @pavel-krush)
- Force title case for enum null prefix (thanks @optiman)
- Fetch column and table info in parallel (thanks @pavel-krush)
- Generate IN/NIN methods for enum type query helpers (thanks @optiman)
- Improve psql performance by isolating uniqueness query (thanks @peterldowns)
- Support for psql materialized view (thanks @severedsea)
- Support loading model relationships when binding to a struct with embedded model (thanks @optiman)
- Fix panic when missing primary key in table (thanks @zapo)
- Fix some SQLite tests by enabling shared cache (thanks @gabe565)
- Fix(sqlite3): narrows
column.AutoGenerated
to columns with INT PKs (thanks @pbedat) - Fix
auto-columns.deleted
not replace the defaultdeleted_at
column name (thanks @shivaluma) - Trim whitespace for column comments (thanks @arp242)
- Add getter methods to relationship structs (thanks @fsaintjacques)
- When title casing UPPER_SNAKE_CASE strings, underscores are not removed for readablity.
- Fix panic when a column referrring a foreign key is ignored (thanks @zapo)
- Fix one single point in paths and polygons (thanks @saulortega)
- Fix performance issue when scanning pgeo point (thanks @ivokanchev)
- Properly assign new query object in models.Pural()
- Add config options to allow user defined rules for inflections
- Don't generate test suites for views
- Properly assign new query object in models.Pural()
- Fix false negatives for enum values
- Strip non alphanumeric characters when title casing.
- Use correct column alias during soft delete
- Use a default "table.*" for model queries
- Fixes issue with column name quotinc in many-to-many eager load
- Properly honor
--no-back-referencing
in relationship setops - Retract
v4.9.0
due to issues with the commit tagging and the generated code showingv4.8.6
- Add
AllEnum()
function to retrieve a slice of all valid values of an enum type - Add
DefaultTemplates
toboilingcore.Config
to change the base template files to use for generation - Add
CustomTemplateFuncs
toboilingcore.Config
to supply additional functions that can be used in templates (thanks @ccakes)
- Fixes issues with detecting enum values that contain uppercases
- Properly wrap column names in quotes when loading many-to-many relationships (thanks @bryanmcgrane)
- Removes duplicated
deleted_at IS NULL
clause in relationship queries (thanks @ktakenaka)
- Add missing function
func (modelQuery) DeleteAllGP(...)
(thanks @parnic)
- Fixed issue with generation of both nullable and non-nullable enum types (thanks @optiman)
- Do not generate a template file if the content is empty
- Add function
drivers.RegisterBinaryFromCmdArg()
to extract binary registration
- Fix panic on zero value of
types.NullDecimal
driver.Value()
for zerotypes.Decimal
is now "0".
- Add new --always-wrap-errors flag that does not unwrap sql.ErrNoRows so it can retain the stack trace. This supports the best practice of using errors.Is() anyway and will eventually become the default behavior in a breaking v5 (thanks @jhnj)
- Add support for * as a wildcard for white/blacklisting columns. See readme for details (thanks @Yoshiji)
- Add missing function
func (modelQuery) UpdateAllGP(...)
(thanks @MeanSquaredError) - Add support for generated columns
- Add support for database views
- Add a
_model
suffix to the generated file for tables names that end with_test
or_goos
or_goarch
since Go treats such files specially. - Add
C
in front of model column attributes that begin with a number since a struct field cannot begin with a number in Go - Add sqlite3 driver to the main repo using the CGo-free port
- Modify the
--add-enum-types
flag to also use the generated types in the model fields (thanks @optiman) - Mark nullable columns as having a default in Postgres driver
- Bump MySQL version used for testing to 8.0
- Fix panic when a column referrring a foreign key is ignored (thanks @zapo)
- Fix bug with using the zero value of the decimal type for a nullable column (thanks @hongshaoyang)
- Fix bad use of titlecase in mysql enum name generation
- Fix regression in enum name generation
- Fix a regression in the soft delete test template generation introduced in 4.8.1
- Add
--add-enum-types
to create distinct enum types instead of strings (thanks @stephenamo)
- Fix a regression in soft delete generation introduced in 4.7.1 (thanks @stephenamo)
- Change template locations to templates/{main,test}. This unfortunate move is necessary to preserve old behavior.
- Revert change to boilingcore.New() both in behavior and function signature
- Add configuration for overriding custom timestamp column names (thanks @stephanafamo)
- Add support for arguments to order by (thanks @emwalker and @alexdor)
- Add support for comments to mysql (thanks @Wuvist)
- Fix CVEs in transitive dependencies by bumping cobra & viper
- Fix inconsistent generation of IsNull/IsNotNull where helpers for types that appear both as null and not null in the database.
- JSON unmarshalling null into types.NullDecimal will no longer panic. String and format have been overridden to return "nil" when the underlying decimal is nil instead of crashing.
- Removed bindata in favor of go:embed. This is not a breaking change as there