更新履歴

v2.0 - 2020.08

GORM 2.0 is a rewrite from scratch, it introduces some incompatible-API change and many improvements

  • パフォーマンスの改善
  • モジュール性の向上
  • Context, Batch Insert, Prepared Statment 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
  • フィールド権限のサポート: 読み取り専用、書き込み専用、作成専用、更新専用、無視するフィールド
  • 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)

GORM 2.0 Release Note

v1.0 - 2016.04

GORM V1 Docs

Breaking Changes:

  • gorm.Open returns *gorm.DB instead of gorm.DB
  • Updating will only update changed fields
  • Soft Delete’s will only check deleted_at IS NULL
  • New ToDBName logic Common initialisms from golint like HTTP, URI was converted to lowercase, so HTTP‘s db name is http, but not h_t_t_p, but for some other initialisms not in the list, like SKU, it’s db name was s_k_u, this change fixed it to sku
  • RecordNotFoundエラー が ErrRecordNotFound に改名されました
  • mssql dialect has been renamed to github.com/jinzhu/gorm/dialects/mssql
  • Hstore has been moved to package github.com/jinzhu/gorm/dialects/postgres