Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 42 for Key (0.16 sec)

  1. callbacks/preload.go

    	preloadMap := parsePreloadMap(db.Statement.Schema, preloads)
    
    	// avoid random traversal of the map
    	preloadNames := make([]string, 0, len(preloadMap))
    	for key := range preloadMap {
    		preloadNames = append(preloadNames, key)
    	}
    	sort.Strings(preloadNames)
    
    	isJoined := func(name string) (joined bool, nestedJoins []string) {
    		for _, join := range joins {
    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)
  2. tests/error_translator_test.go

    		t.Fatalf("expected err: %v got err: %v", gorm.ErrDuplicatedKey, err)
    	}
    }
    
    func TestSupportedDialectorWithErrForeignKeyViolated(t *testing.T) {
    	tidbSkip(t, "not support the foreign key feature")
    
    	type City struct {
    		gorm.Model
    		Name string `gorm:"unique"`
    	}
    
    	type Museum struct {
    		gorm.Model
    		Name   string `gorm:"unique"`
    		CityID uint
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jul 12 13:21:22 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  3. gorm.go

    	})
    }
    
    // Set store value with key into current db instance's context
    func (db *DB) Set(key string, value interface{}) *DB {
    	tx := db.getInstance()
    	tx.Statement.Settings.Store(key, value)
    	return tx
    }
    
    // Get get value with key from current db instance's context
    func (db *DB) Get(key string) (interface{}, bool) {
    	return db.Statement.Settings.Load(key)
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Aug 20 11:46:56 GMT 2023
    - 11.6K bytes
    - Viewed (0)
  4. utils/utils_test.go

    	cases := []struct {
    		values []interface{}
    		key    string
    	}{
    		{[]interface{}{"a"}, "a"},
    		{[]interface{}{1, 2, 3}, "1_2_3"},
    		{[]interface{}{1, nil, 3}, "1_nil_3"},
    		{[]interface{}{[]interface{}{1, 2, 3}}, "[1 2 3]"},
    		{[]interface{}{[]interface{}{"1", "2", "3"}}, "[1 2 3]"},
    		{[]interface{}{[]interface{}{"1", nil, "3"}}, "[1 <nil> 3]"},
    	}
    	for _, c := range cases {
    		if key := ToStringKey(c.values...); key != c.key {
    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)
  5. tests/associations_test.go

    		t.Fatalf("No error occurred during clearind not null association")
    	}
    }
    
    func TestForeignKeyConstraints(t *testing.T) {
    	tidbSkip(t, "not support the foreign key feature")
    
    	type Profile struct {
    		ID       uint
    		Name     string
    		MemberID uint
    	}
    
    	type Member struct {
    		ID      uint
    		Refer   uint `gorm:"uniqueIndex"`
    		Name    string
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Feb 08 08:29:09 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  6. schema/relationship.go

    		for _, foreignKey := range relation.foreignKeys {
    			if field := schema.LookUpField(foreignKey); field != nil {
    				ownForeignFields = append(ownForeignFields, field)
    			} else {
    				schema.err = fmt.Errorf("invalid foreign key: %s", foreignKey)
    				return
    			}
    		}
    	}
    
    	if len(relation.primaryKeys) > 0 {
    		refForeignFields = []*Field{}
    		for _, foreignKey := range relation.primaryKeys {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 22.4K bytes
    - Viewed (0)
  7. schema/field.go

    				)
    
    				if rv.Kind() == reflect.Struct && !rvType.ConvertibleTo(TimeReflectType) {
    					for i := 0; i < rvType.NumField(); i++ {
    						for key, value := range ParseTagSetting(rvType.Field(i).Tag.Get("gorm"), ";") {
    							if _, ok := field.TagSettings[key]; !ok {
    								field.TagSettings[key] = value
    							}
    						}
    					}
    
    					for i := 0; i < rvType.NumField(); i++ {
    						newFieldType := rvType.Field(i).Type
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 32K bytes
    - Viewed (1)
  8. tests/non_std_test.go

    package tests_test
    
    import (
    	"testing"
    	"time"
    )
    
    type Animal struct {
    	Counter    uint64 `gorm:"primary_key:yes"`
    	Name       string `gorm:"DEFAULT:'galeone'"`
    	From       string // test reserved sql keyword as field name
    	Age        *time.Time
    	unexported string // unexported value
    	CreatedAt  time.Time
    	UpdatedAt  time.Time
    }
    
    func TestNonStdPrimaryKeyAndDefaultValues(t *testing.T) {
    	DB.Migrator().DropTable(&Animal{})
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.9K bytes
    - Viewed (0)
  9. association.go

    			}
    		}
    
    		// save associations
    		if association.saveAssociation( /*clear*/ true, values...); association.Error != nil {
    			return association.Error
    		}
    
    		// set old associations's foreign key to null
    		switch rel.Type {
    		case schema.BelongsTo:
    			if len(values) == 0 {
    				updateMap := map[string]interface{}{}
    				switch reflectValue.Kind() {
    				case reflect.Slice, reflect.Array:
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu May 04 11:30:45 GMT 2023
    - 21.2K bytes
    - Viewed (0)
  10. schema/schema.go

    		}
    		return nil, fmt.Errorf("%w: %s.%s", ErrUnsupportedDataType, modelType.PkgPath(), modelType.Name())
    	}
    
    	// Cache the Schema for performance,
    	// Use the modelType or modelType + schemaTable (if it present) as cache key.
    	var schemaCacheKey interface{}
    	if specialTableName != "" {
    		schemaCacheKey = fmt.Sprintf("%p-%s", modelType, specialTableName)
    	} else {
    		schemaCacheKey = modelType
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Oct 10 06:50:29 GMT 2023
    - 13.7K bytes
    - Viewed (0)
Back to top