- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 11 for exists (0.18 sec)
-
callbacks/preload.go
} datas, ok := identityMap[utils.ToStringKey(fieldValues...)] if !ok { return fmt.Errorf("failed to assign association %#v, make sure foreign fields exists", elem.Interface()) } for _, data := range datas { reflectFieldValue := rel.Field.ReflectValueOf(tx.Statement.Context, data) if reflectFieldValue.Kind() == reflect.Ptr && reflectFieldValue.IsNil() {
Go - Registered: Sun Apr 21 09:35:09 GMT 2024 - Last Modified: Mon Apr 15 03:20:20 GMT 2024 - 11.3K bytes - Viewed (0) -
tests/associations_belongs_to_test.go
t.Errorf("Error happened when append company to user, got %v", err) } if users[0].CompanyID == nil || users[1].CompanyID == nil || *users[0].CompanyID != *users[1].CompanyID { t.Errorf("user's company id should exists and equal, but its: %v, %v", users[0].CompanyID, users[1].CompanyID) } DB.Model(&users[0]).Association("Company").Delete(&company) AssertAssociationCount(t, users[0], "Company", 0, "After Delete")
Go - Registered: Sun Apr 21 09:35:09 GMT 2024 - Last Modified: Mon Oct 30 09:15:49 GMT 2023 - 9.3K bytes - Viewed (0) -
statement.go
} else { name := v.Name() c := stmt.Clauses[name] c.Name = name v.MergeClause(&c) stmt.Clauses[name] = c } } // AddClauseIfNotExists add clause if not exists func (stmt *Statement) AddClauseIfNotExists(v clause.Interface) { if c, ok := stmt.Clauses[v.Name()]; !ok || c.Expression == nil { stmt.AddClause(v) } } // BuildCondition build condition
Go - Registered: Sun Apr 21 09:35:09 GMT 2024 - Last Modified: Fri Jan 12 08:42:21 GMT 2024 - 19.8K bytes - Viewed (0) -
utils/utils_test.go
} } } func TestContains(t *testing.T) { containsTests := []struct { name string elems []string elem string out bool }{ {"exists", []string{"1", "2", "3"}, "1", true}, {"not exists", []string{"1", "2", "3"}, "4", false}, } for _, test := range containsTests { t.Run(test.name, func(t *testing.T) { if out := Contains(test.elems, test.elem); test.out != out {
Go - Registered: Sun Apr 21 09:35:09 GMT 2024 - Last Modified: Mon Feb 19 03:42:25 GMT 2024 - 3.6K bytes - Viewed (0) -
callbacks.go
return true } if cs[j].after == "*" && cs[i].after != "*" { return true } return false }) for _, c := range cs { // show warning message the callback name already exists if idx := getRIndex(names, c.name); idx > -1 && !c.replace && !c.remove && !cs[idx].remove { c.processor.db.Logger.Warn(context.Background(), "duplicated callback `%s` from %s\n", c.name, utils.FileWithLineNum()) }
Go - Registered: Sun Apr 21 09:35:09 GMT 2024 - Last Modified: Tue Mar 26 03:33:36 GMT 2024 - 8.6K bytes - Viewed (1) -
tests/preload_test.go
if len(user3.Pets) != 0 { t.Fatalf("User.Pet[0] was deleted and should not exist.") } var user4 *User DB.Preload("Pets.Toy").Find(&user4, "id = ?", user.ID) if len(user4.Pets) != 0 { t.Fatalf("User.Pet[0] was deleted and should not exist.") } var user5 User DB.Unscoped().Preload(clause.Associations+"."+clause.Associations).Find(&user5, "id = ?", user.ID)
Go - Registered: Sun Apr 21 09:35:09 GMT 2024 - Last Modified: Mon Apr 15 03:20:20 GMT 2024 - 13.4K bytes - Viewed (0) -
tests/create_test.go
CheckUser(t, result2, user2) } func TestFirstOrCreateNotExistsTable(t *testing.T) { company := Company{Name: "first_or_create_if_not_exists_table"} if err := DB.Table("not_exists").FirstOrCreate(&company).Error; err == nil { t.Errorf("not exists table, but err is nil") } } func TestFirstOrCreateWithPrimaryKey(t *testing.T) { company := Company{ID: 100, Name: "company100_with_primarykey"}
Go - Registered: Sun Apr 21 09:35:09 GMT 2024 - Last Modified: Tue Mar 19 03:50:28 GMT 2024 - 26.4K bytes - Viewed (0) -
migrator/migrator.go
tx := m.DB.Session(&gorm.Session{}) if err := m.RunWithValue(values[i], func(stmt *gorm.Statement) error { return tx.Exec("DROP TABLE IF EXISTS ?", m.CurrentTable(stmt)).Error }); err != nil { return err } } return nil } // HasTable returns table exists or not for value, value could be a struct or string func (m Migrator) HasTable(value interface{}) bool { var count int64
Go - Registered: Sun Apr 21 09:35:09 GMT 2024 - Last Modified: Mon Mar 18 11:24:16 GMT 2024 - 28.5K bytes - Viewed (0) -
callbacks/helper_test.go
t.Fatalf("loaded should be false") } if loaded = loadOrStoreVisitMap(&vm, reflect.ValueOf(&t1)); !loaded { t.Fatalf("loaded should be true") } // t1 already exist but t2 not if loaded = loadOrStoreVisitMap(&vm, reflect.ValueOf([]*testM{&t1, &t2, &t3})); loaded { t.Fatalf("loaded should be false") }
Go - Registered: Sun Apr 21 09:35:09 GMT 2024 - Last Modified: Tue Mar 05 02:22:57 GMT 2024 - 3.4K bytes - Viewed (0) -
finisher_api.go
// 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 // result := db.Where(User{Name: "non_existing"}).Attrs(User{Email: "******@****.***"}).FirstOrCreate(&user) // // user -> User{Name: "non_existing", Email: "******@****.***"}
Go - Registered: Sun Apr 21 09:35:09 GMT 2024 - Last Modified: Fri Jan 12 08:42:21 GMT 2024 - 22.7K bytes - Viewed (0)