v2.0 - 2020.08
GORM 2.0 is a rewrite from scratch, it introduces some incompatible-API change and many improvements
- Performance Improvements
- Modularity
- Context, Batch Insert, Prepared Statement Mode, DryRun Mode, Join Preload, Find To Map, Create From Map, FindInBatches supports
- Nested Transaction/SavePoint/RollbackTo SavePoint supports
- Named Argument, Group Conditions, Upsert, Locking, Optimizer/Index/Comment Hints supports, SubQuery improvements
- Full self-reference relationships supports, Join Table improvements, Association Mode for batch data
- Multiple fields support for tracking create/update time, which adds support for UNIX (milli/nano) seconds
- Field permissions support: read-only, write-only, create-only, update-only, ignored
- New plugin system: multiple databases, read/write splitting support with plugin Database Resolver, prometheus integrations…
- New Hooks API: unified interface with plugins
- New Migrator: allows to create database foreign keys for relationships, constraints/checker support, enhanced index support
- New Logger: context support, improved extensibility
- Unified Naming strategy: table name, field name, join table name, foreign key, checker, index name rules
- Better customized data type support (e.g: JSON)
v1.0 - 2016.04
Breaking Changes:
gorm.Open
returns*gorm.DB
instead ofgorm.DB
- Updating will only update changed fields
- Soft Delete’s will only check
deleted_at IS NULL
- New ToDBName logic
Common initialisms from golint likeHTTP
,URI
was converted to lowercase, soHTTP
‘s db name ishttp
, but noth_t_t_p
, but for some other initialisms not in the list, likeSKU
, it’s db name wass_k_u
, this change fixed it tosku
- Error
RecordNotFound
has been renamed toErrRecordNotFound
mssql
dialect has been renamed togithub.com/jinzhu/gorm/dialects/mssql
Hstore
has been moved to packagegithub.com/jinzhu/gorm/dialects/postgres