Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 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. callbacks/create.go

    		// append @id column with value for auto-increment primary key
    		// the @id value is correct, when: 1. without setting auto-increment primary key, 2. database AutoIncrementIncrement = 1
    		switch values := db.Statement.Dest.(type) {
    		case map[string]interface{}:
    			values[pkFieldName] = insertID
    		case *map[string]interface{}:
    			(*values)[pkFieldName] = insertID
    		case []map[string]interface{}, *[]map[string]interface{}:
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  4. 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)
  5. utils/utils.go

    	results := make([]string, len(values))
    
    	for idx, value := range values {
    		if valuer, ok := value.(driver.Valuer); ok {
    			value, _ = valuer.Value()
    		}
    
    		switch v := value.(type) {
    		case string:
    			results[idx] = v
    		case []byte:
    			results[idx] = string(v)
    		case uint:
    			results[idx] = strconv.FormatUint(uint64(v), 10)
    		default:
    			results[idx] = "nil"
    			vv := reflect.ValueOf(v)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 22 06:43:02 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  6. 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)
  7. tests/preload_test.go

    	}
    }
    
    func TestEmbedPreload(t *testing.T) {
    	type Country struct {
    		ID   int `gorm:"primaryKey"`
    		Name string
    	}
    	type EmbeddedAddress struct {
    		ID        int
    		Name      string
    		CountryID *int
    		Country   *Country
    	}
    	type NestedAddress struct {
    		EmbeddedAddress
    	}
    	type Org struct {
    		ID              int
    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)
  8. callbacks/preload.go

    			return err
    		}
    	}
    
    	fieldValues := make([]interface{}, len(relForeignFields))
    
    	// clean up old values before preloading
    	switch reflectValue.Kind() {
    	case reflect.Struct:
    		switch rel.Type {
    		case schema.HasMany, schema.Many2Many:
    			tx.AddError(rel.Field.Set(tx.Statement.Context, reflectValue, reflect.MakeSlice(rel.Field.IndirectFieldType, 0, 10).Interface()))
    		default:
    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)
  9. schema/relationship.go

    	has       RelationshipType = "has"
    )
    
    type Relationships struct {
    	HasOne    []*Relationship
    	BelongsTo []*Relationship
    	HasMany   []*Relationship
    	Many2Many []*Relationship
    	Relations map[string]*Relationship
    
    	EmbeddedRelations map[string]*Relationships
    }
    
    type Relationship struct {
    	Name                     string
    	Type                     RelationshipType
    	Field                    *Field
    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)
  10. schema/field.go

    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/utils"
    )
    
    // special types' reflect type
    var (
    	TimeReflectType    = reflect.TypeOf(time.Time{})
    	TimePtrReflectType = reflect.TypeOf(&time.Time{})
    	ByteReflectType    = reflect.TypeOf(uint8(0))
    )
    
    type (
    	// DataType GORM data type
    	DataType string
    	// TimeType GORM time type
    	TimeType int64
    )
    
    // GORM time types
    const (
    	UnixTime        TimeType = 1
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 32K bytes
    - Viewed (1)
Back to top