Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 50 for Fields (0.21 sec)

  1. interfaces.go

    	"gorm.io/gorm/schema"
    )
    
    // Dialector GORM database dialector
    type Dialector interface {
    	Name() string
    	Initialize(*DB) error
    	Migrator(db *DB) Migrator
    	DataTypeOf(*schema.Field) string
    	DefaultValueOf(*schema.Field) clause.Expression
    	BindVarTo(writer clause.Writer, stmt *Statement, v interface{})
    	QuoteTo(clause.Writer, string)
    	Explain(sql string, vars ...interface{}) string
    }
    
    // Plugin GORM plugin interface
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Aug 19 13:33:31 GMT 2023
    - 2.2K bytes
    - Viewed (0)
  2. tests/non_std_test.go

    	}
    
    	animal = Animal{From: "somewhere"}              // No name fields, should be filled with the default value (galeone)
    	DB.Save(&animal).Update("From", "a nice place") // The name field shoul be untouched
    	DB.First(&animal, animal.Counter)
    	if animal.Name != "galeone" {
    		t.Errorf("Name fields shouldn't be changed if untouched, but got %v", animal.Name)
    	}
    
    	// When changing a field with a default value, the change must occur
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.9K bytes
    - Viewed (0)
  3. utils/utils_test.go

    	"math"
    	"strings"
    	"testing"
    	"time"
    )
    
    func TestIsValidDBNameChar(t *testing.T) {
    	for _, db := range []string{"db", "dbName", "db_name", "db1", "1dbname", "db$name"} {
    		if fields := strings.FieldsFunc(db, IsValidDBNameChar); len(fields) != 1 {
    			t.Fatalf("failed to parse db name %v", db)
    		}
    	}
    }
    
    func TestCheckTruth(t *testing.T) {
    	checkTruthTests := []struct {
    		v   string
    		out bool
    	}{
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Feb 19 03:42:25 GMT 2024
    - 3.6K bytes
    - Viewed (0)
  4. 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)
  5. schema/relationship.go

    	PrimaryKey    *Field
    	PrimaryValue  string
    	ForeignKey    *Field
    	OwnPrimaryKey bool
    }
    
    func (schema *Schema) parseRelation(field *Field) *Relationship {
    	var (
    		err        error
    		fieldValue = reflect.New(field.IndirectFieldType).Interface()
    		relation   = &Relationship{
    			Name:        field.Name,
    			Field:       field,
    			Schema:      schema,
    			foreignKeys: toColumns(field.TagSettings["FOREIGNKEY"]),
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 22.4K bytes
    - Viewed (0)
  6. gorm.go

    	relation, ok := modelSchema.Relationships.Relations[field]
    	isRelation := ok && relation.JoinTable != nil
    	if !isRelation {
    		return fmt.Errorf("failed to find relation: %s", field)
    	}
    
    	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)
    		}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Aug 20 11:46:56 GMT 2023
    - 11.6K bytes
    - Viewed (0)
  7. tests/query_test.go

    	}
    
    	stmt := dryDB.Clauses(clause.OrderBy{
    		Expression: clause.Expr{SQL: "FIELD(id,?)", Vars: []interface{}{[]int{1, 2, 3}}, WithoutParentheses: true},
    	}).Find(&User{}).Statement
    
    	explainedSQL := dryDB.Dialector.Explain(stmt.SQL.String(), stmt.Vars...)
    	if !regexp.MustCompile("SELECT \\* FROM .*users.* ORDER BY FIELD\\(id,1,2,3\\)").MatchString(explainedSQL) {
    		t.Fatalf("Build Order condition, but got %v", explainedSQL)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 49.8K bytes
    - Viewed (0)
  8. association.go

    					for i := 0; i < reflectValue.Len(); i++ {
    						association.Error = rel.Field.Set(association.DB.Statement.Context, reflectValue.Index(i), reflect.Zero(rel.Field.FieldType).Interface())
    					}
    				case reflect.Struct:
    					association.Error = rel.Field.Set(association.DB.Statement.Context, reflectValue, reflect.Zero(rel.Field.FieldType).Interface())
    				}
    
    				for _, ref := range rel.References {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu May 04 11:30:45 GMT 2023
    - 21.2K bytes
    - Viewed (0)
  9. schema/constraint_test.go

    			Name:  "uni_user_uniques_name1",
    			Field: &schema.Field{Name: "Name1", Unique: true},
    		},
    	}
    	for k, result := range results {
    		v, ok := constraints[k]
    		if !ok {
    			t.Errorf("Failed to found unique constraint %v from parsed constraints %+v", k, constraints)
    		}
    		tests.AssertObjEqual(t, result, v, "Name")
    		tests.AssertObjEqual(t, result.Field, v.Field, "Name", "Unique", "UniqueIndex")
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 2.2K bytes
    - Viewed (0)
  10. tests/associations_test.go

    	AssertEqual(t, err, gorm.ErrPrimaryKeyRequired)
    }
    
    type (
    	myType           string
    	emptyQueryClause struct {
    		Field *schema.Field
    	}
    )
    
    func (myType) QueryClauses(f *schema.Field) []clause.Interface {
    	return []clause.Interface{emptyQueryClause{Field: f}}
    }
    
    func (sd emptyQueryClause) Name() string {
    	return "empty"
    }
    
    func (sd emptyQueryClause) Build(clause.Builder) {
    }
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Feb 08 08:29:09 GMT 2023
    - 10.9K bytes
    - Viewed (0)
Back to top