Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for DataType (0.19 sec)

  1. migrator/migrator.go

    func (m Migrator) DataTypeOf(field *schema.Field) string {
    	fieldValue := reflect.New(field.IndirectFieldType)
    	if dataTyper, ok := fieldValue.Interface().(GormDataTypeInterface); ok {
    		if dataType := dataTyper.GormDBDataType(m.DB, field); dataType != "" {
    			return dataType
    		}
    	}
    
    	return m.Dialector.DataTypeOf(field)
    }
    
    // FullDataTypeOf returns field's db full data type
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  2. schema/schema_helper_test.go

    			parsedField, ok = s.FieldsByName[f.Name]
    		}
    
    		if !ok {
    			t.Errorf("schema %v failed to look up field with name %v", s, f.Name)
    		} else {
    			tests.AssertObjEqual(t, parsedField, f, "Name", "DBName", "BindNames", "DataType", "PrimaryKey", "AutoIncrement", "Creatable", "Updatable", "Readable", "HasDefaultValue", "DefaultValue", "NotNull", "Unique", "Comment", "Size", "Precision", "TagSettings")
    
    			if f.DBName != "" {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  3. tests/migrate_test.go

    						columnType)
    				}
    			case "name":
    				dataType := DB.Dialector.DataTypeOf(stmt.Schema.LookUpField(columnType.Name()))
    				if !strings.Contains(strings.ToUpper(dataType), strings.ToUpper(columnType.DatabaseTypeName())) {
    					t.Fatalf("column name type should be correct, name: %v, length: %v, expects: %v, column: %#v",
    						columnType.Name(), columnType.DatabaseTypeName(), dataType, columnType)
    				}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  4. schema/schema_test.go

    		{Name: "Name", DBName: "name", BindNames: []string{"Name"}, DataType: schema.String},
    		{Name: "Age", DBName: "age", BindNames: []string{"Age"}, DataType: schema.Uint, Size: 64},
    		{Name: "Birthday", DBName: "birthday", BindNames: []string{"Birthday"}, DataType: schema.Time},
    		{Name: "CompanyID", DBName: "company_id", BindNames: []string{"CompanyID"}, DataType: schema.Int, Size: 64},
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 12.9K bytes
    - Viewed (0)
  5. schema/field_test.go

    		{Name: "ID", DBName: "id", BindNames: []string{"ID"}, DataType: schema.Uint, PrimaryKey: true, Size: 64, Creatable: true, Updatable: true, Readable: true, HasDefaultValue: true, AutoIncrement: true},
    		{Name: "Name", DBName: "", BindNames: []string{"Name"}, DataType: "", Tag: `gorm:"-"`, Creatable: false, Updatable: false, Readable: false},
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Feb 19 09:02:53 GMT 2022
    - 12.7K bytes
    - Viewed (0)
  6. schema/field.go

    			field.DataType = Bytes
    		}
    	}
    
    	if dataTyper, ok := fieldValue.Interface().(GormDataTypeInterface); ok {
    		field.DataType = DataType(dataTyper.GormDataType())
    	}
    
    	if v, ok := field.TagSettings["AUTOCREATETIME"]; (ok && utils.CheckTruth(v)) || (!ok && field.Name == "CreatedAt" && (field.DataType == Time || field.DataType == Int || field.DataType == Uint)) {
    		if field.DataType == Time {
    			field.AutoCreateTime = UnixTime
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 32K bytes
    - Viewed (1)
  7. statement.go

    								if field.DBName != "" {
    									conds = append(conds, clause.Eq{Column: clause.Column{Table: clause.CurrentTable, Name: field.DBName}, Value: v})
    								} else if field.DataType != "" {
    									conds = append(conds, clause.Eq{Column: clause.Column{Table: clause.CurrentTable, Name: field.Name}, Value: v})
    								}
    							}
    						}
    					}
    				case reflect.Slice, reflect.Array:
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
  8. schema/relationship.go

    				relation.FieldSchema, schema, field.Name)
    			return
    		}
    
    		// use same data type for foreign keys
    		if copyableDataType(primaryKeyField.DataType) {
    			relation.Polymorphic.PolymorphicID.DataType = primaryKeyField.DataType
    		}
    		relation.Polymorphic.PolymorphicID.GORMDataType = primaryKeyField.GORMDataType
    		if relation.Polymorphic.PolymorphicID.Size == 0 {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 22.4K bytes
    - Viewed (0)
  9. schema/schema.go

    			} else {
    				schema.Fields = append(schema.Fields, field)
    			}
    		}
    	}
    
    	for _, field := range schema.Fields {
    		if field.DBName == "" && field.DataType != "" {
    			field.DBName = namer.ColumnName(schema.Table, field.Name)
    		}
    
    		bindName := field.BindName()
    		if field.DBName != "" {
    			// nonexistence or shortest path or first appear prioritized if has permission
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Oct 10 06:50:29 GMT 2023
    - 13.7K bytes
    - Viewed (0)
  10. gorm.go

    	for _, ref := range relation.References {
    		f := joinSchema.LookUpField(ref.ForeignKey.DBName)
    		if f == nil {
    			return fmt.Errorf("missing field %s for join table", ref.ForeignKey.DBName)
    		}
    
    		f.DataType = ref.ForeignKey.DataType
    		f.GORMDataType = ref.ForeignKey.GORMDataType
    		if f.Size == 0 {
    			f.Size = ref.ForeignKey.Size
    		}
    		ref.ForeignKey = f
    	}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sun Aug 20 11:46:56 GMT 2023
    - 11.6K bytes
    - Viewed (0)
Back to top