- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 10 for exists (0.2 sec)
-
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 May 05 09:35:13 GMT 2024 - Last Modified: Tue Mar 26 03:33:36 GMT 2024 - 8.6K bytes - Viewed (1) -
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 May 05 09:35:13 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 May 05 09:35:13 GMT 2024 - Last Modified: Fri Apr 26 07:15:49 GMT 2024 - 29K 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 May 05 09:35:13 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 May 05 09:35:13 GMT 2024 - Last Modified: Fri Jan 12 08:42:21 GMT 2024 - 22.7K bytes - Viewed (0) -
tests/migrate_test.go
} // RelationModel3 should be existed _, err = findColumnType(&RelationModel3{}, "id") AssertEqual(t, nil, err) // RelationModel1 should not be existed _, err = findColumnType(&RelationModel1{}, "id") if err == nil { t.Errorf("RelationModel1 should not be migrated") } // RelationModel2 should not be existed _, err = findColumnType(&RelationModel2{}, "id")
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Mon Mar 18 11:24:16 GMT 2024 - 56.2K bytes - Viewed (0) -
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 May 05 09:35:13 GMT 2024 - Last Modified: Thu Apr 25 12:21:03 GMT 2024 - 11.6K 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 May 05 09:35:13 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 May 05 09:35:13 GMT 2024 - Last Modified: Mon Feb 19 03:42:25 GMT 2024 - 3.6K bytes - Viewed (0) -
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 May 05 09:35:13 GMT 2024 - Last Modified: Thu Apr 25 12:21:03 GMT 2024 - 14.9K bytes - Viewed (0)