- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 48 for tx (0.05 sec)
-
callbacks/preload.go
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:52:33 UTC 2024 - 11.6K bytes - Viewed (0) -
chainable_api.go
func (db *DB) Select(query interface{}, args ...interface{}) (tx *DB) { tx = db.getInstance() switch v := query.(type) { case []string: tx.Statement.Selects = v for _, arg := range args { switch arg := arg.(type) { case string: tx.Statement.Selects = append(tx.Statement.Selects, arg) case []string: tx.Statement.Selects = append(tx.Statement.Selects, arg...) default:
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 24 09:42:59 UTC 2024 - 14.8K bytes - Viewed (0) -
finisher_api.go
tx := db.getInstance().Set("rows", false) tx = tx.callbacks.Row().Execute(tx) row, ok := tx.Statement.Dest.(*sql.Row) if !ok && tx.DryRun { db.Logger.Error(tx.Statement.Context, ErrDryRunModeUnsupported.Error()) } return row } func (db *DB) Rows() (*sql.Rows, error) { tx := db.getInstance().Set("rows", true) tx = tx.callbacks.Row().Execute(tx) rows, ok := tx.Statement.Dest.(*sql.Rows)
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Sat Sep 14 12:58:29 UTC 2024 - 22.8K bytes - Viewed (0) -
gorm.go
func (db *DB) Debug() (tx *DB) { tx = db.getInstance() return tx.Session(&Session{ Logger: db.Logger.LogMode(logger.Info), }) } // Set store value with key into current db instance's context func (db *DB) Set(key string, value interface{}) *DB { tx := db.getInstance() tx.Statement.Settings.Store(key, value) return tx } // Get get value with key from current db instance's context
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Oct 09 11:29:48 UTC 2024 - 12.1K bytes - Viewed (0) -
tests/connpool_test.go
if err = tx.Save(&user1).Error; err != nil { t.Fatalf("No error should raise, but got %v", err) } if err = tx.First(&User{}, "name = ?", user1.Name).Error; err != nil { t.Fatalf("Should find saved record, but got %v", err) } if sqlTx, ok := tx.Statement.ConnPool.(gorm.TxCommitter); !ok || sqlTx == nil { t.Fatalf("Should return the underlying sql.Tx") } tx.Rollback()
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Feb 06 02:54:40 UTC 2024 - 5.5K bytes - Viewed (0) -
callbacks/associations.go
tx = tx.Set("gorm:update_track_time", true) } if len(selects) > 0 { tx = tx.Select(selects) } else if restricted && len(omits) == 0 { tx = tx.Omit(clause.Associations) } if len(omits) > 0 { tx = tx.Omit(omits...) } return db.AddError(tx.Create(values).Error) } // check association values has been saved // if values kind is Struct, check it has been saved
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Apr 11 03:06:13 UTC 2023 - 14.3K bytes - Viewed (0) -
callbacks/delete.go
queryConds := rel.ToQueryConditions(db.Statement.Context, db.Statement.ReflectValue) modelValue := reflect.New(rel.FieldSchema.ModelType).Interface() tx := db.Session(&gorm.Session{NewDB: true}).Model(modelValue) withoutConditions := false if db.Statement.Unscoped { tx = tx.Unscoped() } if len(db.Statement.Selects) > 0 { selects := make([]string, 0, len(db.Statement.Selects))
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Feb 25 02:48:23 UTC 2022 - 5.6K bytes - Viewed (0) -
tests/preload_test.go
expect: org, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { actual := Org{} tx := DB.Where("id = ?", org.ID).Session(&gorm.Session{}) for name, args := range test.preloads { tx = tx.Preload(name, args...) } if err := tx.Find(&actual).Error; err != nil { t.Errorf("failed to find org, got err: %v", err) } AssertEqual(t, actual, test.expect) })
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:00:47 UTC 2024 - 15.9K bytes - Viewed (0) -
prepare_stmt.go
return tx.Tx.Rollback() } return ErrInvalidTransaction } func (tx *PreparedStmtTX) ExecContext(ctx context.Context, query string, args ...interface{}) (result sql.Result, err error) { stmt, err := tx.PreparedStmtDB.prepare(ctx, tx.Tx, true, query) if err == nil { result, err = tx.Tx.StmtContext(ctx, stmt.Stmt).ExecContext(ctx, args...) if errors.Is(err, driver.ErrBadConn) {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Aug 22 11:02:05 UTC 2024 - 6.6K bytes - Viewed (0) -
callbacks/update.go
callMethod(db, func(value interface{}, tx *gorm.DB) (called bool) { if db.Statement.Schema.BeforeSave { if i, ok := value.(BeforeSaveInterface); ok { called = true db.AddError(i.BeforeSave(tx)) } } if db.Statement.Schema.BeforeUpdate { if i, ok := value.(BeforeUpdateInterface); ok { called = true db.AddError(i.BeforeUpdate(tx)) } } return called })
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Mar 18 05:44:55 UTC 2024 - 9.4K bytes - Viewed (0)