- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 67 for ID (0.14 sec)
-
tests/postgres_test.go
t.Fatalf("should be able to create data, but got %v", err) } if yasuo.ID == "" { t.Fatal("should be able to has ID, but got zero value") } var result Yasuo if err := DB.First(&result, "id = ?", yasuo.ID).Error; err != nil || yasuo.Name != "jinzhu" { t.Errorf("No error should happen, but got %v", err) } if err := DB.Where("id = $1", yasuo.ID).First(&Yasuo{}).Error; err != nil || yasuo.Name != "jinzhu" {
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Sat Oct 08 09:16:32 GMT 2022 - 6.4K bytes - Viewed (3) -
tests/upsert_test.go
} if user1.Name != "find or create" || user1.ID == 0 || user1.Age != 33 { t.Errorf("user should be created with search value") } DB.Where(&User{Name: "find or create", Age: 33}).FirstOrCreate(&user2) if user1.ID != user2.ID || user2.Name != "find or create" || user2.ID == 0 || user2.Age != 33 { t.Errorf("user should be created with search value") }
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Mon Sep 05 07:39:19 GMT 2022 - 11.4K bytes - Viewed (0) -
callbacks/create_test.go
type user struct { ID int `gorm:"primaryKey"` Name string Email string `gorm:"default:(-)"` Age int `gorm:"default:(-)"` } s, err := schema.Parse(&user{}, schemaCache, schema.NamingStrategy{}) if err != nil { t.Errorf("parse schema error: %v, is not expected", err) return } dest := []*user{ { ID: 1, Name: "alice", Email: "email",
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Mon Mar 18 05:48:42 GMT 2024 - 1.4K bytes - Viewed (0) -
tests/distinct_test.go
} dryDB := DB.Session(&gorm.Session{DryRun: true}) r := dryDB.Distinct("u.id, u.*").Table("user_speaks as s").Joins("inner join users as u on u.id = s.user_id").Where("s.language_code ='US' or s.language_code ='ES'").Find(&User{}) if !regexp.MustCompile(`SELECT DISTINCT u\.id, u\.\* FROM user_speaks as s inner join users as u`).MatchString(r.Statement.SQL.String()) {
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Thu Jan 06 07:02:53 GMT 2022 - 2.5K bytes - Viewed (0) -
clause/select_test.go
Exprs: []clause.Expression{ clause.NamedExpr{"?", []interface{}{clause.Column{Name: "id"}}}, clause.NamedExpr{"?", []interface{}{clause.Column{Name: "name"}}}, clause.NamedExpr{"LENGTH(?)", []interface{}{clause.Column{Name: "mobile"}}}, }, }, }, clause.From{}}, "SELECT `id`, `name`, LENGTH(`mobile`) FROM `users`", nil, }, { []clause.Interface{clause.Select{
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Sat Feb 18 01:06:43 GMT 2023 - 1.7K bytes - Viewed (0) -
schema/schema_helper_test.go
} if r.Polymorphic != nil { if r.Polymorphic.PolymorphicID.Name != relation.Polymorphic.ID { t.Errorf("schema %v relation's polymorphic id field expects %v, but got %v", s, relation.Polymorphic.ID, r.Polymorphic.PolymorphicID.Name) } if r.Polymorphic.PolymorphicType.Name != relation.Polymorphic.Type {
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Fri Dec 15 08:31:23 GMT 2023 - 7.5K bytes - Viewed (0) -
utils/tests/models.go
} type Tools struct { gorm.Model Name string CustomID string Type string } type Company struct { ID int Name string } type Language struct { Code string `gorm:"primarykey"` Name string } type Coupon struct { ID int `gorm:"primarykey; size:255"` AppliesToProduct []*CouponProduct `gorm:"foreignKey:CouponId;constraint:OnDelete:CASCADE"`
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Fri Dec 15 08:36:08 GMT 2023 - 2.1K bytes - Viewed (0) -
tests/hooks_test.go
DB.Model(&Product5{}).Create(&p) err := DB.Model(&Product5{}).Where("id", p.ID).Update("name", "update_name_1").Error if err != nil { t.Fatalf("should update success, but got err %v", err) } if beforeUpdateCall != 1 { t.Fatalf("before update should be called") } err = DB.Model(Product5{}).Where("id", p.ID).Update("name", "update_name_2").Error if !errors.Is(err, gorm.ErrInvalidValue) {
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) -
tests/scopes_test.go
} var maxId int64 userTable := func(db *gorm.DB) *gorm.DB { return db.WithContext(context.Background()).Table("users") } if err := DB.Scopes(userTable).Select("max(id)").Scan(&maxId).Error; err != nil { t.Errorf("select max(id)") } } func TestComplexScopes(t *testing.T) { tests := []struct { name string queryFn func(tx *gorm.DB) *gorm.DB expected string }{ { name: "depth_1",
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Fri Jan 12 08:42:21 GMT 2024 - 3.3K bytes - Viewed (0) -
chainable_api.go
} return } // Joins specify Joins conditions // // db.Joins("Account").Find(&user) // db.Joins("JOIN emails ON emails.user_id = users.id AND emails.email = ?", "******@****.***").Find(&user) // db.Joins("Account", DB.Select("id").Where("user_id = users.id AND name = ?", "someName").Model(&Account{})) func (db *DB) Joins(query string, args ...interface{}) (tx *DB) { return joins(db, clause.LeftJoin, query, args...)
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Wed Apr 17 03:38:55 GMT 2024 - 14.3K bytes - Viewed (1)