- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 17 for splice (0.17 sec)
-
callbacks/helper_test.go
expect clause.Values }{ { name: "Test convert slice of string value", input: []map[string]interface{}{ {"name": "my name"}, }, expect: clause.Values{ Columns: []clause.Column{{Name: "name"}}, Values: [][]interface{}{{"my name"}}, }, }, { name: "Test convert slice of int value", input: []map[string]interface{}{ {"age": 18}, },
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) -
clause/set_test.go
}) } } func TestAssignments(t *testing.T) { set := clause.Assignments(map[string]interface{}{ "name": "jinzhu", "age": 18, }) assignments := []clause.Assignment(set) sort.Slice(assignments, func(i, j int) bool { return strings.Compare(assignments[i].Column.Name, assignments[j].Column.Name) > 0 })
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Thu Jan 06 07:02:53 GMT 2022 - 1.4K bytes - Viewed (0) -
callbacks.go
c.name = name c.handler = fn c.replace = true c.processor.callbacks = append(c.processor.callbacks, c) return c.processor.compile() } // getRIndex get right index from string slice func getRIndex(strs []string, str string) int { for i := len(strs) - 1; i >= 0; i-- { if strs[i] == str { return i } } return -1 }
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) -
callbacks/create_test.go
import ( "reflect" "sync" "testing" "time" "gorm.io/gorm" "gorm.io/gorm/clause" "gorm.io/gorm/schema" ) var schemaCache = &sync.Map{} func TestConvertToCreateValues_DestType_Slice(t *testing.T) { type user struct { ID int `gorm:"primaryKey"` Name string Email string `gorm:"default:(-)"` Age int `gorm:"default:(-)"` }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Mon Mar 18 05:48:42 GMT 2024 - 1.4K bytes - Viewed (0) -
clause/expression.go
if _, ok := expr.Vars[idx].(driver.Valuer); ok { builder.AddVar(builder, expr.Vars[idx]) } else { switch rv := reflect.ValueOf(expr.Vars[idx]); rv.Kind() { case reflect.Slice, reflect.Array: if rv.Len() == 0 { builder.AddVar(builder, nil) } else { for i := 0; i < rv.Len(); i++ { if i > 0 { builder.WriteByte(',') }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Tue Oct 10 06:45:48 GMT 2023 - 8.3K bytes - Viewed (0) -
errors.go
// ErrEmptySlice empty slice found ErrEmptySlice = errors.New("empty slice found") // ErrDryRunModeUnsupported dry run mode unsupported ErrDryRunModeUnsupported = errors.New("dry run mode unsupported") // ErrInvalidDB invalid db ErrInvalidDB = errors.New("invalid db") // ErrInvalidValue invalid value ErrInvalidValue = errors.New("invalid value, should be pointer to struct or slice")
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) -
utils/tests/utils.go
t.Errorf("%v: expect: %+v, got %+v", utils.FileWithLineNum(), expect, got) return } if reflect.ValueOf(got).Kind() == reflect.Slice { if reflect.ValueOf(expect).Kind() == reflect.Slice { if reflect.ValueOf(got).Len() == reflect.ValueOf(expect).Len() { for i := 0; i < reflect.ValueOf(got).Len(); i++ { name := fmt.Sprintf(reflect.ValueOf(got).Type().Name()+" #%v", i)
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Mar 10 09:21:56 GMT 2023 - 3.9K bytes - Viewed (0) -
tests/helper_test.go
if len(user.Pets) != len(expect.Pets) { t.Fatalf("pets should equal, expect: %v, got %v", len(expect.Pets), len(user.Pets)) } sort.Slice(user.Pets, func(i, j int) bool { return user.Pets[i].ID > user.Pets[j].ID }) sort.Slice(expect.Pets, func(i, j int) bool { return expect.Pets[i].ID > expect.Pets[j].ID }) for idx, pet := range user.Pets {
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Tue Mar 19 03:50:28 GMT 2024 - 8K bytes - Viewed (0) -
tests/associations_has_one_test.go
t.Errorf("account's number should not be saved") } } func TestHasOneAssociationForSlice(t *testing.T) { users := []User{ *GetUser("slice-hasone-1", Config{Account: true}), *GetUser("slice-hasone-2", Config{Account: false}), *GetUser("slice-hasone-3", Config{Account: true}), } DB.Create(&users) // Count AssertAssociationCount(t, users, "Account", 2, "") // Find
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Thu Jan 06 07:02:53 GMT 2022 - 6.8K bytes - Viewed (0) -
schema/utils.go
settings := map[string]string{} names := strings.Split(str, sep) for i := 0; i < len(names); i++ { j := i if len(names[j]) > 0 { for { if names[j][len(names[j])-1] == '\\' { i++ names[j] = names[j][0:len(names[j])-1] + sep + names[i] names[i] = "" } else { break } } } values := strings.Split(names[j], ":")
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Sat Aug 19 13:35:14 GMT 2023 - 5.5K bytes - Viewed (0)