Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 79 for Len (0.17 sec)

  1. schema/utils.go

    func ParseTagSetting(str string, sep string) map[string]string {
    	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 Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Aug 19 13:35:14 GMT 2023
    - 5.5K bytes
    - Viewed (0)
  2. tests/helper_test.go

    					"Number")
    			}
    		}
    	})
    
    	t.Run("Pets", func(t *testing.T) {
    		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
    		})
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 8K bytes
    - Viewed (0)
  3. tests/scan_test.go

    		t.Fatalf("Failed to query with pointer of value, got error %v", err)
    	} else if rus := resInt5.([]User); len(rus) != 3 {
    		t.Fatalf("Scan into struct should work, got %+v, len %v", resInt5, len(rus))
    	}
    }
    
    func TestScanRows(t *testing.T) {
    	user1 := User{Name: "ScanRowsUser1", Age: 1}
    	user2 := User{Name: "ScanRowsUser2", Age: 10}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat May 28 14:18:07 GMT 2022
    - 8.2K bytes
    - Viewed (0)
  4. schema/index.go

    					length, _  = strconv.Atoi(settings["LENGTH"])
    				)
    
    				if idx == -1 {
    					idx = len(tag)
    				}
    
    				if idx != -1 {
    					name = tag[0:idx]
    				}
    
    				if name == "" {
    					subName := field.Name
    					const key = "COMPOSITE"
    					if composite, found := settings[key]; found {
    						if len(composite) == 0 || composite == key {
    							err = fmt.Errorf(
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 3.7K bytes
    - Viewed (0)
  5. tests/associations_has_one_test.go

    	// Count
    	AssertAssociationCount(t, users, "Account", 2, "")
    
    	// Find
    	var accounts []Account
    	if DB.Model(&users).Association("Account").Find(&accounts); len(accounts) != 2 {
    		t.Errorf("accounts count should be %v, but got %v", 3, len(accounts))
    	}
    
    	// Append
    	DB.Model(&users).Association("Account").Append(
    		&Account{Number: "account-slice-append-1"},
    		&Account{Number: "account-slice-append-2"},
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 6.8K bytes
    - Viewed (0)
  6. schema/index_test.go

    				return
    			}
    			tests.AssertObjEqual(t, ai, ei, "Name", "Class", "Type", "Where", "Comment", "Option")
    			if len(ei.Fields) != len(ai.Fields) {
    				t.Errorf("expected index %q field length is %d but actual %d", k, len(ei.Fields), len(ai.Fields))
    				return
    			}
    			for i, ef := range ei.Fields {
    				af := ai.Fields[i]
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 8K bytes
    - Viewed (0)
  7. tests/scanner_valuer_test.go

    	ExampleStruct    ExampleStruct
    	ExampleStructPtr *ExampleStruct
    }
    
    type EncryptedData []byte
    
    func (data *EncryptedData) Scan(value interface{}) error {
    	if b, ok := value.([]byte); ok {
    		if len(b) < 3 || b[0] != '*' || b[1] != '*' || b[2] != '*' {
    			return errors.New("Too short")
    		}
    
    		*data = append((*data)[0:], b[3:]...)
    		return nil
    	} else if s, ok := value.(string); ok {
    		*data = []byte(s[3:])
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Jun 07 07:02:07 GMT 2023
    - 10.6K bytes
    - Viewed (0)
  8. callbacks/callmethod.go

    	if called := fc(db.Statement.ReflectValue.Interface(), tx); !called {
    		switch db.Statement.ReflectValue.Kind() {
    		case reflect.Slice, reflect.Array:
    			db.Statement.CurDestIndex = 0
    			for i := 0; i < db.Statement.ReflectValue.Len(); i++ {
    				if value := reflect.Indirect(db.Statement.ReflectValue.Index(i)); value.CanAddr() {
    					fc(value.Addr().Interface(), tx)
    				} else {
    					db.AddError(gorm.ErrInvalidValue)
    					return
    				}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 846 bytes
    - Viewed (0)
  9. clause/select.go

    type Select struct {
    	Distinct   bool
    	Columns    []Column
    	Expression Expression
    }
    
    func (s Select) Name() string {
    	return "SELECT"
    }
    
    func (s Select) Build(builder Builder) {
    	if len(s.Columns) > 0 {
    		if s.Distinct {
    			builder.WriteString("DISTINCT ")
    		}
    
    		for idx, column := range s.Columns {
    			if idx > 0 {
    				builder.WriteByte(',')
    			}
    			builder.WriteQuoted(column)
    		}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Jul 14 07:51:24 GMT 2021
    - 1.1K bytes
    - Viewed (0)
  10. callbacks/associations.go

    							relPrimaryValues := make([]interface{}, 0, len(rel.FieldSchema.PrimaryFields))
    							for _, pf := range rel.FieldSchema.PrimaryFields {
    								if pfv, ok := pf.ValueOf(db.Statement.Context, rv); !ok {
    									relPrimaryValues = append(relPrimaryValues, pfv)
    								}
    							}
    							cacheKey := utils.ToStringKey(relPrimaryValues...)
    							if len(relPrimaryValues) != len(rel.FieldSchema.PrimaryFields) || !identityMap[cacheKey] {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Apr 11 03:06:13 GMT 2023
    - 14.3K bytes
    - Viewed (0)
Back to top