- Sort Score
- Result 10 results
- Languages All
Results 11 - 20 of 81 for Model (0.15 sec)
-
tests/multi_primary_keys_test.go
DB.Model(&blog).Association("Tags").Delete(tag5) var tags3 []Tag DB.Model(&blog).Association("Tags").Find(&tags3) if !compareTags(tags3, []string{"tag6"}) { t.Fatalf("Should find 1 tags after Delete") } if DB.Model(&blog).Association("Tags").Count() != 1 { t.Fatalf("Blog should has three tags after Delete") } DB.Model(&blog).Association("Tags").Delete(tag3) var tags4 []Tag
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Thu Jan 06 07:02:53 GMT 2022 - 12.8K bytes - Viewed (0) -
tests/associations_belongs_to_test.go
// Clear DB.Model(&users).Association("Company").Clear() AssertAssociationCount(t, users, "Company", 0, "After Clear") DB.Model(&users).Association("Manager").Clear() AssertAssociationCount(t, users, "Manager", 0, "After Clear") // shared company company := Company{Name: "shared"} if err := DB.Model(&users[0]).Association("Company").Append(&company); err != nil {
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Mon Oct 30 09:15:49 GMT 2023 - 9.3K bytes - Viewed (0) -
tests/joins_table_test.go
} if DB.Unscoped().Model(&person).Association("Addresses").Count() != 2 { t.Fatalf("Should found soft deleted addresses with unscoped") } DB.Model(&person).Association("Addresses").Clear() if DB.Model(&person).Association("Addresses").Count() != 0 { t.Fatalf("Should deleted all addresses") } if DB.Unscoped().Model(&person).Association("Addresses").Count() != 2 {
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Thu Sep 10 13:46:18 GMT 2020 - 3.5K bytes - Viewed (0) -
tests/sql_builder_test.go
dryRunDB := DB.Session(&gorm.Session{DryRun: true}) stmt := dryRunDB.Model(&user).Where("id = ?", 1).Updates(map[string]interface{}{"age": ageInt(8)}).Statement sql := DB.Dialector.Explain(stmt.SQL.String(), stmt.Vars...) if !regexp.MustCompile(`.*age.*=8,`).MatchString(sql) { t.Errorf("Failed to generate sql, got %v", sql) }
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Fri Jan 12 08:42:21 GMT 2024 - 16.7K bytes - Viewed (0) -
istioctl/pkg/writer/envoy/configdump/cluster.go
"istio.io/istio/istioctl/pkg/util/proto" "istio.io/istio/pilot/pkg/model" v3 "istio.io/istio/pilot/pkg/xds/v3" "istio.io/istio/pkg/config/host" ) // ClusterFilter is used to pass filter information into cluster based config writer print functions type ClusterFilter struct { FQDN host.Name Port int Subset string Direction model.TrafficDirection }
Go - Registered: Wed Apr 24 22:53:08 GMT 2024 - Last Modified: Thu May 11 05:38:17 GMT 2023 - 5.9K bytes - Viewed (0) -
tests/query_test.go
var simpleUser2 SimpleUser if err := DB.Model(&User{}).Select("id").First(&simpleUser2, user.ID).Error; err != nil { t.Fatalf("Failed to query smaller user, got error %v", err) } AssertObjEqual(t, user, simpleUser2, "ID") var simpleUsers []SimpleUser if err := DB.Model(&User{}).Select("id").Find(&simpleUsers, user.ID).Error; err != nil || len(simpleUsers) != 1 {
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Thu Apr 25 12:22:53 GMT 2024 - 49.8K bytes - Viewed (0) -
chainable_api.go
"gorm.io/gorm/clause" "gorm.io/gorm/utils" ) // Model specify the model you would like to run db operations // // // update all users's name to `hello` // db.Model(&User{}).Update("name", "hello") // // if user's primary key is non-blank, will use it as condition, then will only update that user's name to `hello` // db.Model(&user).Update("name", "hello") func (db *DB) Model(value interface{}) (tx *DB) { tx = db.getInstance()
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) -
tests/distinct_test.go
AssertObjEqual(t, results[idx], expect, "Name", "Age") } var count int64 if err := DB.Model(&User{}).Where("name like ?", "distinct%").Count(&count).Error; err != nil || count != 5 { t.Errorf("failed to query users count, got error: %v, count: %v", err, count) } if err := DB.Model(&User{}).Distinct("name").Where("name like ?", "distinct%").Count(&count).Error; err != nil || count != 3 {
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) -
soft_delete.go
stmt.AddClause(clause.Where{Exprs: []clause.Expression{clause.IN{Column: column, Values: values}}}) } if stmt.ReflectValue.CanAddr() && stmt.Dest != stmt.Model && stmt.Model != nil { _, queryValues = schema.GetIdentityFieldValuesMap(stmt.Context, reflect.ValueOf(stmt.Model), stmt.Schema.PrimaryFields) column, values = schema.ToQueryValues(stmt.Table, stmt.Schema.PrimaryFieldDBNames, queryValues) if len(values) > 0 {
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Wed Feb 01 06:40:55 GMT 2023 - 4.5K bytes - Viewed (0) -
tests/delete_test.go
if count := DB.Unscoped().Model(&user).Association(key).Count(); count != value { t.Errorf("user's %v expects: %v, got %v", key, value, count) } } for key, value := range map[string]int64{"Account": 0, "Pets": 0, "Toys": 0, "Company": 1, "Manager": 1, "Team": 0, "Languages": 0, "Friends": 0} { if count := DB.Model(&user).Association(key).Count(); count != value {
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Tue Oct 10 07:03:34 GMT 2023 - 9.4K bytes - Viewed (0)