Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 23 for defaults (0.31 sec)

  1. schema/serializer.go

    	fieldValue := reflect.New(field.FieldType)
    
    	if dbValue != nil {
    		var bytes []byte
    		switch v := dbValue.(type) {
    		case []byte:
    			bytes = v
    		case string:
    			bytes = []byte(v)
    		default:
    			return fmt.Errorf("failed to unmarshal JSONB value: %#v", dbValue)
    		}
    
    		if len(bytes) > 0 {
    			err = json.Unmarshal(bytes, fieldValue.Interface())
    		}
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 08:28:46 GMT 2024
    - 4.6K bytes
    - Viewed (0)
  2. tests/create_test.go

    	users := []User{
    		*GetUser("create_with_default_batch_size_1", Config{Account: true, Pets: 2, Toys: 3, Company: true, Manager: true, Team: 0, Languages: 1, Friends: 1}),
    		*GetUser("create_with_default_batch_sizs_2", Config{Account: false, Pets: 2, Toys: 4, Company: false, Manager: false, Team: 1, Languages: 3, Friends: 5}),
    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)
  3. scan.go

    		*sql.NullBool, *sql.NullString, *sql.NullTime:
    		for initialized || rows.Next() {
    			initialized = false
    			db.RowsAffected++
    			db.AddError(rows.Scan(dest))
    		}
    	default:
    		var (
    			fields       = make([]*schema.Field, len(columns))
    			joinFields   [][]*schema.Field
    			sch          = db.Statement.Schema
    			reflectValue = db.Statement.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)
  4. callbacks/create_test.go

    )
    
    var schemaCache = &sync.Map{}
    
    func TestConvertToCreateValues_DestType_Slice(t *testing.T) {
    	type user struct {
    		ID    int `gorm:"primaryKey"`
    		Name  string
    		Email string `gorm:"default:(-)"`
    		Age   int    `gorm:"default:(-)"`
    	}
    
    	s, err := schema.Parse(&user{}, schemaCache, schema.NamingStrategy{})
    	if err != nil {
    		t.Errorf("parse schema error: %v, is not expected", err)
    		return
    	}
    	dest := []*user{
    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)
  5. logger/sql.go

    		return true
    	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
    		return true
    	case reflect.Float32, reflect.Float64:
    		return true
    	default:
    		return false
    	}
    }
    
    // ExplainSQL generate SQL string with given parameters, the generated SQL is expected to be used in logger, execute it might introduce a SQL injection vulnerability
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 08:00:02 GMT 2024
    - 5K bytes
    - Viewed (0)
  6. chainable_api.go

    				default:
    					tx.Statement.AddClause(clause.Select{
    						Distinct:   db.Statement.Distinct,
    						Expression: clause.Expr{SQL: v, Vars: args},
    					})
    					return
    				}
    			}
    
    			if clause, ok := tx.Statement.Clauses["SELECT"]; ok {
    				clause.Expression = nil
    				tx.Statement.Clauses["SELECT"] = clause
    			}
    		}
    	default:
    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. migrator/migrator.go

    			m.Dialector.BindVarTo(defaultStmt, defaultStmt, field.DefaultValueInterface)
    			expr.SQL += " DEFAULT " + m.Dialector.Explain(defaultStmt.SQL.String(), field.DefaultValueInterface)
    		} else if field.DefaultValue != "(-)" {
    			expr.SQL += " DEFAULT " + field.DefaultValue
    		}
    	}
    
    	return
    }
    
    func (m Migrator) GetQueryAndExecTx() (queryTx, execTx *gorm.DB) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  8. utils/utils.go

    		}
    
    		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)
    			if vv.IsValid() && !vv.IsZero() {
    				results[idx] = fmt.Sprint(reflect.Indirect(vv).Interface())
    			}
    		}
    	}
    
    	return strings.Join(results, "_")
    }
    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)
  9. tests/migrate_test.go

    		t.Errorf("Failed to migrate, got %v", err)
    	}
    
    	type ColumnStruct2 struct {
    		ID    int    `gorm:"primarykey;default:auto_random()"`
    		Name  string `gorm:"size:100"`
    		Code  string `gorm:"unique;comment:my code2;default:hello"`
    		Code2 string `gorm:"comment:my code2;default:hello"`
    	}
    
    	if err := DB.Table("column_structs").Migrator().AlterColumn(&ColumnStruct{}, "Name"); err != nil {
    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)
  10. callbacks/create.go

    			}
    
    			for _, mapValue := range mapValues {
    				if mapValue != nil {
    					mapValue[pkFieldName] = insertID
    				}
    				insertID += schema.DefaultAutoIncrementIncrement
    			}
    		default:
    			if pkField == nil {
    				return
    			}
    
    			switch db.Statement.ReflectValue.Kind() {
    			case reflect.Slice, reflect.Array:
    				if config.LastInsertIDReversed {
    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)
Back to top