- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 20 for records (0.18 sec)
-
tests/create_test.go
} if _, ok := records[0]["@id"]; ok && fmt.Sprint(res2["id"]) != fmt.Sprint(records[0]["@id"]) { t.Errorf("failed to create data from map with table, @id != id, got %v, expect %v", res2["id"], records[0]["@id"]) } if _, ok := records[1]["id"]; ok && fmt.Sprint(res3["id"]) != fmt.Sprint(records[1]["@id"]) { t.Errorf("failed to create data from map with table, @id != id") }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Tue Mar 19 03:50:28 GMT 2024 - 26.4K bytes - Viewed (0) -
chainable_api.go
return } // Assign provide attributes used in [FirstOrCreate] or [FirstOrInit] // // Assign adds attributes even if the record is found. If using FirstOrCreate, this means that // records will be updated even if they are found. // // // assign an email regardless of if the record is not found // db.Where(User{Name: "non_existing"}).Assign(User{Email: "******@****.***"}).FirstOrInit(&user)
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Wed Apr 17 03:38:55 GMT 2024 - 14.3K bytes - Viewed (1) -
logger/logger.go
SlowThreshold: 200 * time.Millisecond, LogLevel: Warn, IgnoreRecordNotFoundError: false, Colorful: true, }) // Recorder logger records running SQL into a recorder instance Recorder = traceRecorder{Interface: Default, BeginAt: time.Now()} ) // New initialize logger func New(writer Writer, config Config) Interface { var ( infoStr = "%s\n[info] "
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Tue Nov 07 02:19:41 GMT 2023 - 5.8K bytes - Viewed (0) -
finisher_api.go
} return } // FirstOrCreate finds the first matching record, otherwise if not found creates a new instance with given conds. // Each conds must be a struct or map. // // Using FirstOrCreate in conjunction with Assign will result in an update to the database even if the record exists. // // // assign an email if the record is not found
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Jan 12 08:42:21 GMT 2024 - 22.7K bytes - Viewed (0) -
tests/soft_delete_test.go
t.Errorf("Can't find a soft deleted record") } count = 0 if DB.Model(&User{}).Where("name = ?", user.Name).Count(&count).Error != nil || count != 0 { t.Errorf("Count soft deleted record, expects: %v, got: %v", 0, count) } age = 0 if DB.Model(&User{}).Select("age").Where("name = ?", user.Name).Scan(&age).Error != nil || age != 0 { t.Errorf("Age soft deleted record, expects: %v, got: %v", 0, age) }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Wed Feb 01 06:40:55 GMT 2023 - 5.7K bytes - Viewed (0) -
tests/connpool_test.go
return c.db.Ping() } // If you use BeginTx returned *sql.Tx as shown below then you can't record queries in a transaction. // // func (c *wrapperConnPool) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) { // return c.db.BeginTx(ctx, opts) // } // // You should use BeginTx returned gorm.Tx which could wrap *sql.Tx then you can record all queries.
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Tue Feb 06 02:54:40 GMT 2024 - 5.5K bytes - Viewed (0) -
tests/joins_test.go
Joins("JOIN languages ON languages.code = user_speaks.language_code"). Joins("LEFT OUTER JOIN pets ON pets.user_id = users.id").Find(&results) if len(results) == 0 { t.Fatalf("no record find") } else if results[0].Pet.UserID == nil || *(results[0].Pet.UserID) != user.ID { t.Fatalf("wrong user id in pet") } else if results[0].Pet.Name != user.Pets[0].Name { t.Fatalf("wrong pet name") } }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Wed Apr 26 14:19:32 GMT 2023 - 13.5K bytes - Viewed (1) -
tests/update_test.go
t.Errorf("should only update one record, but got %v", rowsAffected) } if rowsAffected := DB.Model(users).Where("age > 0").Update("name", "jinzhu").RowsAffected; rowsAffected != 3 { t.Errorf("should only update one record, but got %v", rowsAffected) } } func TestUpdates(t *testing.T) { users := []*User{
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Mon Dec 04 03:50:58 GMT 2023 - 30.3K bytes - Viewed (0) -
tests/hooks_test.go
} if DB.Where("Code = ?", "unique_code").First(&p).Error == nil { t.Fatalf("Can't find a deleted record") } beforeCallTimes := p.AfterFindCallTimes if DB.Where("Code = ?", "unique_code").Find(&p).Error != nil { t.Fatalf("Find don't raise error when record not found") } if p.AfterFindCallTimes != beforeCallTimes { t.Fatalf("AfterFind should not be called") } }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Sat Feb 18 01:20:29 GMT 2023 - 15.9K bytes - Viewed (0) -
errors.go
package gorm import ( "errors" "gorm.io/gorm/logger" ) var ( // ErrRecordNotFound record not found error ErrRecordNotFound = logger.ErrRecordNotFound // ErrInvalidTransaction invalid transaction when you are trying to `Commit` or `Rollback` ErrInvalidTransaction = errors.New("invalid transaction") // ErrNotImplemented not implemented ErrNotImplemented = errors.New("not implemented") // ErrMissingWhereClause missing where clause
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Apr 26 02:53:17 GMT 2024 - 2.5K bytes - Viewed (0)