Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for defaultValue (0.18 sec)

  1. migrator/migrator.go

    			case schema.Time:
    				if !strings.EqualFold(strings.TrimSuffix(dv, "()"), strings.TrimSuffix(field.DefaultValue, "()")) {
    					alterColumn = true
    				}
    			case schema.Bool:
    				v1, _ := strconv.ParseBool(dv)
    				v2, _ := strconv.ParseBool(field.DefaultValue)
    				alterColumn = v1 != v2
    			default:
    				alterColumn = dv != field.DefaultValue
    			}
    		}
    	}
    
    	// check comment
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  2. migrator/column_type.go

    }
    
    // Comment returns the comment of current column.
    func (ct ColumnType) Comment() (value string, ok bool) {
    	return ct.CommentValue.String, ct.CommentValue.Valid
    }
    
    // DefaultValue returns the default value of current column.
    func (ct ColumnType) DefaultValue() (value string, ok bool) {
    	return ct.DefaultValueValue.String, ct.DefaultValueValue.Valid
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 24 01:31:58 GMT 2022
    - 3.3K bytes
    - Viewed (0)
  3. callbacks/create_test.go

    			},
    		},
    		ReflectValue: reflect.ValueOf(dest),
    		Dest:         dest,
    	}
    
    	stmt.Schema = s
    
    	values := ConvertToCreateValues(stmt)
    	expected := clause.Values{
    		// column has value + defaultValue column has value (which should have a stable order)
    		Columns: []clause.Column{{Name: "name"}, {Name: "email"}, {Name: "age"}, {Name: "id"}},
    		Values: [][]interface{}{
    			{"alice", "email", 18, 1},
    			{"bob", "email", 19, 2},
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 05:48:42 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  4. tests/migrate_test.go

    	columnType, err := findColumnType(tableName, "content")
    	AssertEqual(t, err, nil)
    
    	defVal, ok := columnType.DefaultValue()
    	AssertEqual(t, defVal, "null")
    	AssertEqual(t, ok, true)
    
    	columnType2, err := findColumnType(tableName, "active")
    	AssertEqual(t, err, nil)
    
    	defVal, ok = columnType2.DefaultValue()
    	bv, _ := strconv.ParseBool(defVal)
    	AssertEqual(t, bv, false)
    	AssertEqual(t, ok, true)
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  5. migrator.go

    	Length() (length int64, ok bool)
    	DecimalSize() (precision int64, scale int64, ok bool)
    	Nullable() (nullable bool, ok bool)
    	Unique() (unique bool, ok bool)
    	ScanType() reflect.Type
    	Comment() (value string, ok bool)
    	DefaultValue() (value string, ok bool)
    }
    
    type Index interface {
    	Table() string
    	Name() string
    	Columns() []string
    	PrimaryKey() (isPrimaryKey bool, ok bool)
    	Unique() (unique bool, ok bool)
    	Option() string
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  6. schema/schema_helper_test.go

    		} 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 != "" {
    				if field, ok := s.FieldsByDBName[f.DBName]; !ok || parsedField != field {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  7. callbacks/create.go

    						if v, ok := selectColumns[field.DBName]; (ok && v) || (!ok && !restricted) {
    							if !field.PrimaryKey && (!field.HasDefaultValue || field.DefaultValueInterface != nil ||
    								strings.EqualFold(field.DefaultValue, "NULL")) && field.AutoCreateTime == 0 {
    								if field.AutoUpdateTime > 0 {
    									assignment := clause.Assignment{Column: clause.Column{Name: field.DBName}, Value: curTime}
    									switch field.AutoUpdateTime {
    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)
  8. schema/field.go

    	}
    
    	// default value is function or null or blank (primary keys)
    	field.DefaultValue = strings.TrimSpace(field.DefaultValue)
    	skipParseDefaultValue := strings.Contains(field.DefaultValue, "(") &&
    		strings.Contains(field.DefaultValue, ")") || strings.ToLower(field.DefaultValue) == "null" || field.DefaultValue == ""
    	switch reflect.Indirect(fieldValue).Kind() {
    	case reflect.Bool:
    		field.DataType = Bool
    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