Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 29 for type (0.15 sec)

  1. schema/relationship_test.go

    				},
    			},
    		})
    	})
    
    	t.Run("has one with custom polymorphic type and id", func(t *testing.T) {
    		type Toy struct {
    			ID    int
    			Name  string
    			RefId int
    			Type  string
    		}
    
    		type Cat struct {
    			ID   int
    			Name string
    			Toy  Toy `gorm:"polymorphic:Owner;polymorphicType:Type;polymorphicId:RefId"`
    		}
    
    		s, err := schema.Parse(&Cat{}, &sync.Map{}, schema.NamingStrategy{})
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 25.5K bytes
    - Viewed (0)
  2. scan.go

    				update = false
    				if isArrayKind {
    					db.Statement.ReflectValue.Set(reflect.Zero(reflectValue.Type()))
    				} else {
    					// if the slice cap is externally initialized, the externally initialized slice is directly used here
    					if reflectValue.Cap() == 0 {
    						db.Statement.ReflectValue.Set(reflect.MakeSlice(reflectValue.Type(), 0, 20))
    					} else {
    						reflectValue.SetLen(0)
    						db.Statement.ReflectValue.Set(reflectValue)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 09:53:11 GMT 2024
    - 9.8K bytes
    - Viewed (0)
  3. tests/associations_has_many_test.go

    }
    
    func TestHasManyAssociationUnscoped(t *testing.T) {
    	type ItemContent struct {
    		gorm.Model
    		ItemID       uint   `gorm:"not null"`
    		Name         string `gorm:"not null;type:varchar(50)"`
    		LanguageCode string `gorm:"not null;type:varchar(2)"`
    	}
    	type Item struct {
    		gorm.Model
    		Logo     string        `gorm:"not null;type:varchar(50)"`
    		Contents []ItemContent `gorm:"foreignKey:ItemID"`
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 15.6K bytes
    - Viewed (0)
  4. tests/joins_test.go

    }
    
    func TestJoinWithSameColumnName(t *testing.T) {
    	user := GetUser("TestJoinWithSameColumnName", Config{
    		Languages: 1,
    		Pets:      1,
    	})
    	DB.Create(user)
    	type UserSpeak struct {
    		UserID       uint
    		LanguageCode string
    	}
    	type Result struct {
    		User
    		UserSpeak
    		Language
    		Pet
    	}
    
    	results := make([]Result, 0, 1)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 26 14:19:32 GMT 2023
    - 13.5K bytes
    - Viewed (1)
  5. tests/create_test.go

    			t.Fatalf("errors happened when create: %v", err)
    		}
    
    		for _, pet := range pets {
    			CheckPet(t, *pet, *pet)
    		}
    	})
    }
    
    func TestCreateEmptyStruct(t *testing.T) {
    	type EmptyStruct struct {
    		ID uint
    	}
    	DB.Migrator().DropTable(&EmptyStruct{})
    
    	if err := DB.AutoMigrate(&EmptyStruct{}); err != nil {
    		t.Errorf("no error should happen when auto migrate, but got %v", err)
    	}
    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)
  6. migrator/migrator.go

    // TODO:? Create const vars for raw sql queries ?
    
    var _ gorm.Migrator = (*Migrator)(nil)
    
    // Migrator m struct
    type Migrator struct {
    	Config
    }
    
    // Config schema config
    type Config struct {
    	CreateIndexAfterCreateTable bool
    	DB                          *gorm.DB
    	gorm.Dialector
    }
    
    type printSQLLogger struct {
    	logger.Interface
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  7. callbacks/query.go

    			queryFields := db.QueryFields
    			if !queryFields {
    				switch db.Statement.ReflectValue.Kind() {
    				case reflect.Struct:
    					queryFields = db.Statement.ReflectValue.Type() != db.Statement.Schema.ModelType
    				case reflect.Slice:
    					queryFields = db.Statement.ReflectValue.Type().Elem() != db.Statement.Schema.ModelType
    				}
    			}
    
    			if queryFields {
    				stmt := gorm.Statement{DB: db}
    				// smaller struct
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Jan 29 03:34:57 GMT 2024
    - 9.9K bytes
    - Viewed (0)
  8. tests/hooks_test.go

    			t.Errorf("invalid price for product #%v, expects: %v, got %v", idx, value, products2[idx].Price)
    		}
    	}
    }
    
    type Product4 struct {
    	gorm.Model
    	Name  string
    	Code  string
    	Price int64
    	Owner string
    	Item  ProductItem
    }
    
    type ProductItem struct {
    	gorm.Model
    	Code               string
    	Product4ID         uint
    	AfterFindCallTimes int
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 15.9K bytes
    - Viewed (0)
  9. tests/preload_suits_test.go

    		t.Errorf("got %s; want %s", toJSONString(got), toJSONString(want))
    	}
    }
    
    type LevelA1 struct {
    	ID    uint
    	Value string
    }
    
    type LevelA2 struct {
    	ID       uint
    	Value    string
    	LevelA3s []*LevelA3 `json:",omitempty"`
    }
    
    type LevelA3 struct {
    	ID        uint
    	Value     string
    	LevelA1ID sql.NullInt64
    	LevelA1   *LevelA1
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Mar 18 05:38:46 GMT 2022
    - 30.3K bytes
    - Viewed (0)
  10. chainable_api.go

    func (db *DB) Select(query interface{}, args ...interface{}) (tx *DB) {
    	tx = db.getInstance()
    
    	switch v := query.(type) {
    	case []string:
    		tx.Statement.Selects = v
    
    		for _, arg := range args {
    			switch arg := arg.(type) {
    			case string:
    				tx.Statement.Selects = append(tx.Statement.Selects, arg)
    			case []string:
    				tx.Statement.Selects = append(tx.Statement.Selects, arg...)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
Back to top