The fantastic Advanced ORM library for Golang, aims to be developer friendly.
This is a fork of GORM with improved performance and many other features.
- Full-Featured ORM (almost)
- Associations (Has One, Has Many, Belongs To, Many To Many, Polymorphism)
- Hooks (Before/After Create/Save/Update/Delete/Find)
- Preloading (eager loading)
- Transactions
- Composite Primary Key
- SQL Builder
- Auto Migrations
- Logger
- Extendable, write Plugins based on GORM callbacks
- Every feature comes with tests
- Developer Friendly
- NEW: Inline model loader and auto loader
- NEW: Null values scaner without Nullable Field
- NEW: Log callbacks
- NEW: After scanner callbacks
- NEW: Binary ID (using bid.BID)
- NEW: Index/Unique Index withe WHERE clause
- NEW: Raw args binder
- NEW: Custom arg binder by dialect
- NEW: Custom arg valuer by dialect
- NEW: POLYMORPHIC_VALUE tag:
sql:"POLYMORPHIC_VALUE:user"
or singular and plural:sql:"POLYMORPHIC_VALUE:user,users"
- NEW: Dry Run
db.DryRun().First(&user)
- NEW: Model Struct Api:
aorm.StructOf(&User{})
- NEW: Model Struct callbacks
- NEW: Model Struct interface:
aorm.InstaceOf(&User{})
- NEW: ID Api:
aorm.IdOf(&User{ID:1})
- NEW: Get executed query and args
fmt.Println(db.First(&user).Query)
orfmt.Println(db.DryRun().First(&user).Query)
- NEW: Readonly fields with select query
- NEW: Args and Query API
db.First(&user, aorm.Query{"name = ?", []interface{}{"joe"}})
or your type implementsaorm.Clauser
- NEW: Money type
- NEW: Email type
- NEW: String Slice Type (
Strings
) - NEW: Gzb Type: Text with Gzip compression
- NEW: Dynamic table namer
- NEW: Attribute as table
- NEW: Table name with auto prefix from basename of Type PkgPath
- NEW: Index/Unique with
$not_blank
token. - NEW: ID Generator API: ID field type implements
IDGenerator
interface - NEW: Migrator:
err := aorm.NewMigrator(db).Migrate()
- NEW: Quote db object path:
aorm.QuotePath(db.Dialect(), "public.users")
- NEW: and more other changes...
- NEW: Protect Sringer API:
ProtectStringer
. Default implemetations:ProtectedString
andProtectStringerImpl
.
-
NEW: Static SQL dynamic escapes and zeros from special characters:
SqlStringOpen
:'«'
SqlStringClose
:'»'
SqlZeroString
:'ø'
SqlZeroByteArray
:'Ø'
EXAMPLE:
sql := "SELECT * FROM users WHERE name = «moi» OR detail = ø OR recovery_binary_key = Ø" // postgres driver fmt.Println(db.Driver().PrepareSQL(sql))
output:
SELECT * FROM users WHERE name = 'moi' OR detail = '' OR recovery_binary_key = \x''
- NEW: BID Table Partition
WINDOWS NOTE: run these commands inside CygWin or Git Bash.
go get -u github.com/go-aorm/aorm
cd $GOPATH/github.com/go-aorm/aorm
go generate
If uses dep for manage your dependencies, runs:
cd YOUR_PROJECT_DIR
dep ensure -add github.com/go-aorm/aorm
cd vendor/github.com/go-aorm/aorm
go generate
- AORM Guides http://io
You can help to deliver a better GORM, check out things you can do
© Moises P. Sena, 2018~time.Now
Released under the MIT License