Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 46 for Field (0.18 sec)

  1. schema/field.go

    			field.DataType = ""
    			field.IgnoreMigration = true
    		case "migration":
    			field.IgnoreMigration = true
    		}
    	}
    
    	if v, ok := field.TagSettings["->"]; ok {
    		field.Creatable = false
    		field.Updatable = false
    		if strings.ToLower(v) == "false" {
    			field.Readable = false
    		} else {
    			field.Readable = true
    		}
    	}
    
    	if v, ok := field.TagSettings["<-"]; ok {
    		field.Creatable = true
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 32K bytes
    - Viewed (1)
  2. schema/field_test.go

    			t.Errorf("no error should happen when assign value to field %v, but got %v", k, err)
    		}
    	}
    	newValues2["updated_at"] = time.Time{}
    	checkField(t, userSchema, reflectValue, newValues2)
    }
    
    func TestPointerFieldValuerAndSetter(t *testing.T) {
    	var (
    		userSchema, _      = schema.Parse(&User{}, &sync.Map{}, schema.NamingStrategy{})
    		name               = "pointer_field_valuer_and_setter"
    		age           uint = 18
    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)
  3. tests/customize_field_test.go

    	if cc2.Name != "bar" {
    		t.Errorf("Failed to query CustomizeColumn")
    	}
    }
    
    func TestCustomColumnAndIgnoredFieldClash(t *testing.T) {
    	// Make sure an ignored field does not interfere with another field's custom
    	// column name that matches the ignored field.
    	type CustomColumnAndIgnoredFieldClash struct {
    		Body    string `gorm:"-"`
    		RawBody string `gorm:"column:body"`
    	}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Sep 11 09:33:31 GMT 2020
    - 6.9K bytes
    - Viewed (0)
  4. schema/index_test.go

    				{Field: &schema.Field{Name: "FieldD"}},
    			},
    		},
    		"uniq_field_e1_e2": {
    			Name:  "uniq_field_e1_e2",
    			Class: "UNIQUE",
    			Fields: []schema.IndexOption{
    				{Field: &schema.Field{Name: "FieldE1"}},
    				{Field: &schema.Field{Name: "FieldE2"}},
    			},
    		},
    		"idx_index_tests_field_f1": {
    			Name:   "idx_index_tests_field_f1",
    			Fields: []schema.IndexOption{{Field: &schema.Field{Name: "FieldF1"}}},
    		},
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 8K bytes
    - Viewed (0)
  5. schema/index.go

    				if name == "" {
    					subName := field.Name
    					const key = "COMPOSITE"
    					if composite, found := settings[key]; found {
    						if len(composite) == 0 || composite == key {
    							err = fmt.Errorf(
    								"The composite tag of %s.%s cannot be empty",
    								field.Schema.Name,
    								field.Name)
    							return
    						}
    						subName = composite
    					}
    					name = field.Schema.namer.IndexName(
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 3.7K bytes
    - Viewed (0)
  6. schema/utils.go

    		reflectResults = reflect.MakeSlice(reflect.SliceOf(reflect.PtrTo(rel.FieldSchema.ModelType)), 0, 1)
    
    		appendToResults := func(value reflect.Value) {
    			if _, isZero := rel.Field.ValueOf(ctx, value); !isZero {
    				result := reflect.Indirect(rel.Field.ReflectValueOf(ctx, value))
    				switch result.Kind() {
    				case reflect.Struct:
    					reflectResults = reflect.Append(reflectResults, result.Addr())
    				case reflect.Slice, reflect.Array:
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Aug 19 13:35:14 GMT 2023
    - 5.5K bytes
    - Viewed (0)
  7. migrator/migrator.go

    	expr.SQL = m.DataTypeOf(field)
    
    	if field.NotNull {
    		expr.SQL += " NOT NULL"
    	}
    
    	if field.HasDefaultValue && (field.DefaultValueInterface != nil || field.DefaultValue != "") {
    		if field.DefaultValueInterface != nil {
    			defaultStmt := &gorm.Statement{Vars: []interface{}{field.DefaultValueInterface}}
    			m.Dialector.BindVarTo(defaultStmt, defaultStmt, field.DefaultValueInterface)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  8. soft_delete.go

    		}})
    		stmt.Clauses["soft_delete_enabled"] = clause.Clause{}
    	}
    }
    
    func (DeletedAt) UpdateClauses(f *schema.Field) []clause.Interface {
    	return []clause.Interface{SoftDeleteUpdateClause{Field: f, ZeroValue: parseZeroValueTag(f)}}
    }
    
    type SoftDeleteUpdateClause struct {
    	ZeroValue sql.NullString
    	Field     *schema.Field
    }
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Feb 01 06:40:55 GMT 2023
    - 4.5K bytes
    - Viewed (0)
  9. schema/schema_helper_test.go

    				}
    			}
    
    			for _, name := range []string{f.DBName, f.Name} {
    				if name != "" {
    					if field := s.LookUpField(name); field == nil || (field.Name != name && field.DBName != name) {
    						t.Errorf("schema %v failed to look up field with dbname %v", s, f.DBName)
    					}
    				}
    			}
    
    			if f.PrimaryKey {
    				var found bool
    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)
  10. callbacks/associations.go

    						obj := db.Statement.ReflectValue.Index(i)
    						if reflect.Indirect(obj).Kind() != reflect.Struct {
    							break
    						}
    						if _, zero := rel.Field.ValueOf(db.Statement.Context, obj); !zero { // check belongs to relation value
    							rv := rel.Field.ReflectValueOf(db.Statement.Context, obj) // relation reflect value
    							if !isPtr {
    								rv = rv.Addr()
    							}
    							objs = append(objs, obj)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Apr 11 03:06:13 GMT 2023
    - 14.3K bytes
    - Viewed (0)
Back to top