- Sort Score
- Result 10 results
- Languages All
Results 1 - 7 of 7 for Crooks (0.23 sec)
-
tests/transaction_test.go
return tx2.Scan(&User{}).Error }) }) if err != nil { t.Error(err) } // method with hooks err = DB.Transaction(func(tx1 *gorm.DB) error { // callMethod do tx2 := tx1.Find(&User{}).Session(&gorm.Session{NewDB: true}) // trx in hooks return tx2.Transaction(func(tx3 *gorm.DB) error { return tx3.Where("user_id", user.ID).Delete(&Account{}).Error }) })
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Sat Jun 10 13:05:19 GMT 2023 - 10.9K bytes - Viewed (0) -
tests/hooks_test.go
product2 := Product3{Name: "Product", Price: 0} DB.Session(&gorm.Session{SkipHooks: true}).Create(&product2) if product2.Price != 0 { t.Errorf("invalid price after create without hooks, got %+v", product2) } } func TestHooksForSlice(t *testing.T) { DB.Migrator().DropTable(&Product3{}) DB.AutoMigrate(&Product3{}) products := []*Product3{ {Name: "Product-1", Price: 100},
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Sat Feb 18 01:20:29 GMT 2023 - 15.9K bytes - Viewed (0) -
statement.go
// looks like a where condition return []clause.Expression{clause.Expr{SQL: s, Vars: args}} } if len(args) > 0 && strings.Contains(s, "@") { // looks like a named query return []clause.Expression{clause.NamedExpr{SQL: s, Vars: args}} } if strings.Contains(strings.TrimSpace(s), " ") { // looks like a where condition
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Fri Jan 12 08:42:21 GMT 2024 - 19.8K bytes - Viewed (0) -
callbacks/update.go
if _, ok := dest[rel.Name]; ok { db.AddError(rel.Field.Set(db.Statement.Context, db.Statement.ReflectValue, dest[rel.Name])) } } } } } } // BeforeUpdate before update hooks func BeforeUpdate(db *gorm.DB) { if db.Error == nil && db.Statement.Schema != nil && !db.Statement.SkipHooks && (db.Statement.Schema.BeforeSave || db.Statement.Schema.BeforeUpdate) {
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Mon Mar 18 05:44:55 GMT 2024 - 9.4K bytes - Viewed (1) -
README.md
## Overview * Full-Featured ORM * Associations (Has One, Has Many, Belongs To, Many To Many, Polymorphism, Single-table inheritance) * Hooks (Before/After Create/Save/Update/Delete/Find) * Eager loading with `Preload`, `Joins` * Transactions, Nested Transactions, Save Point, RollbackTo to Saved Point * Context, Prepared Statement Mode, DryRun Mode
Plain Text - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Tue Nov 07 02:20:06 GMT 2023 - 1.8K bytes - Viewed (0) -
callbacks/create.go
package callbacks import ( "fmt" "reflect" "strings" "gorm.io/gorm" "gorm.io/gorm/clause" "gorm.io/gorm/schema" "gorm.io/gorm/utils" ) // BeforeCreate before create hooks func BeforeCreate(db *gorm.DB) { if db.Error == nil && db.Statement.Schema != nil && !db.Statement.SkipHooks && (db.Statement.Schema.BeforeSave || db.Statement.Schema.BeforeCreate) { callMethod(db, func(value interface{}, tx *gorm.DB) (called bool) {
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Mon Apr 08 03:29:55 GMT 2024 - 12.5K bytes - Viewed (0) -
schema/schema.go
if field, ok := schema.FieldsByDBName[name]; ok { return field } if field, ok := schema.FieldsByName[name]; ok { return field } return nil } // LookUpFieldByBindName looks for the closest field in the embedded struct. // // type Struct struct { // Embedded struct { // ID string // is selected by LookUpFieldByBindName([]string{"Embedded", "ID"}, "ID") // }
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Tue Oct 10 06:50:29 GMT 2023 - 13.7K bytes - Viewed (0)