Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 50 for field (0.17 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 May 05 09:35:13 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 May 05 09:35:13 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 May 05 09:35:13 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 May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 8K bytes
    - Viewed (0)
  5. schema/index.go

    					idx.Option = index.Option
    				}
    
    				idx.Fields = append(idx.Fields, index.Fields...)
    				sort.Slice(idx.Fields, func(i, j int) bool {
    					return idx.Fields[i].priority < idx.Fields[j].priority
    				})
    
    				indexes[index.Name] = idx
    			}
    		}
    	}
    	for _, index := range indexes {
    		if index.Class == "UNIQUE" && len(index.Fields) == 1 {
    			index.Fields[0].Field.UniqueIndex = index.Name
    		}
    	}
    	return indexes
    }
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 3.7K bytes
    - Viewed (0)
  6. schema/utils.go

    		reflectValue = reflectValue.Elem()
    	}
    
    	switch reflectValue.Kind() {
    	case reflect.Struct:
    		results = [][]interface{}{make([]interface{}, len(fields))}
    
    		for idx, field := range fields {
    			results[0][idx], zero = field.ValueOf(ctx, reflectValue)
    			notZero = notZero || !zero
    		}
    
    		if !notZero {
    			return nil, nil
    		}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Aug 19 13:35:14 GMT 2023
    - 5.5K bytes
    - Viewed (0)
  7. scan.go

    							relFields = append(relFields, rel.Field)
    							for _, name := range names[1 : subNameCount-1] {
    								rel = rel.FieldSchema.Relationships.Relations[name]
    								relFields = append(relFields, rel.Field)
    							}
    							// lastest name is raw dbname
    							dbName := names[subNameCount-1]
    							if field := rel.FieldSchema.LookUpField(dbName); field != nil && field.Readable {
    								fields[idx] = field
    
    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)
  8. schema/constraint.go

    }
    
    // ParseUniqueConstraints parse schema unique constraints
    func (schema *Schema) ParseUniqueConstraints() map[string]UniqueConstraint {
    	uniques := make(map[string]UniqueConstraint)
    	for _, field := range schema.Fields {
    		if field.Unique {
    			name := schema.namer.UniqueName(schema.Table, field.DBName)
    			uniques[name] = UniqueConstraint{Name: name, Field: field}
    		}
    	}
    	return uniques
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 07:33:54 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  9. schema/serializer.go

    	Value(ctx context.Context, field *Field, dst reflect.Value, fieldValue interface{}) (interface{}, error)
    }
    
    // JSONSerializer json serializer
    type JSONSerializer struct{}
    
    // Scan implements serializer interface
    func (JSONSerializer) Scan(ctx context.Context, field *Field, dst reflect.Value, dbValue interface{}) (err error) {
    	fieldValue := reflect.New(field.FieldType)
    
    	if dbValue != nil {
    		var bytes []byte
    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)
  10. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 7.5K bytes
    - Viewed (0)
Back to top