Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 46 for FIELD (0.14 sec)

  1. statement.go

    				switch reflectValue.Kind() {
    				case reflect.Struct:
    					for _, field := range s.Fields {
    						selected := selectedColumns[field.DBName] || selectedColumns[field.Name]
    						if selected || (!restricted && field.Readable) {
    							if v, isZero := field.ValueOf(stmt.Context, reflectValue); !isZero || selected {
    								if field.DBName != "" {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
  2. callbacks/preload.go

    				tx.AddError(rel.Field.Set(tx.Statement.Context, reflectValue.Index(i), reflect.MakeSlice(rel.Field.IndirectFieldType, 0, 10).Interface()))
    			default:
    				tx.AddError(rel.Field.Set(tx.Statement.Context, reflectValue.Index(i), reflect.New(rel.Field.FieldType).Interface()))
    			}
    		}
    	}
    
    	for i := 0; i < reflectResults.Len(); i++ {
    		elem := reflectResults.Index(i)
    		for idx, field := range relForeignFields {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  3. tests/serializer_test.go

    	switch value := dbValue.(type) {
    	case []byte:
    		err = field.Set(ctx, dst, bytes.TrimPrefix(value, c.prefix))
    	case string:
    		err = field.Set(ctx, dst, strings.TrimPrefix(value, string(c.prefix)))
    	default:
    		err = fmt.Errorf("unsupported data %#v", dbValue)
    	}
    	return err
    }
    
    func (c *CustomSerializer) Value(ctx context.Context, field *schema.Field, dst reflect.Value, fieldValue interface{}) (interface{}, error) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 21 14:09:38 GMT 2023
    - 7.6K bytes
    - Viewed (0)
  4. schema/schema_test.go

    	}
    
    	prioritizedPrimaryField := schema.Field{
    		Name: "ProductID", DBName: "product_id", BindNames: []string{"ProductID"}, DataType: schema.Uint, PrimaryKey: true, Size: 64, HasDefaultValue: true, AutoIncrement: true, TagSettings: map[string]string{"PRIMARYKEY": "PRIMARYKEY", "AUTOINCREMENT": "AUTOINCREMENT"},
    	}
    
    	product.Fields = []*schema.Field{product.PrioritizedPrimaryField}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 12.9K bytes
    - Viewed (0)
  5. callbacks/helper.go

    	for k := range mapValue {
    		keys = append(keys, k)
    	}
    	sort.Strings(keys)
    
    	for _, k := range keys {
    		value := mapValue[k]
    		if stmt.Schema != nil {
    			if field := stmt.Schema.LookUpField(k); field != nil {
    				k = field.DBName
    			}
    		}
    
    		if v, ok := selectColumns[k]; (ok && v) || (!ok && !restricted) {
    			values.Columns = append(values.Columns, clause.Column{Name: k})
    			if len(values.Values) == 0 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 14 12:32:57 GMT 2022
    - 3.7K bytes
    - Viewed (0)
  6. utils/tests/dummy_dialecter.go

    		DeleteClauses:        []string{"DELETE", "FROM", "WHERE", "RETURNING"},
    		LastInsertIDReversed: true,
    	})
    
    	return nil
    }
    
    func (DummyDialector) DefaultValueOf(field *schema.Field) clause.Expression {
    	return clause.Expr{SQL: "DEFAULT"}
    }
    
    func (DummyDialector) Migrator(*gorm.DB) gorm.Migrator {
    	return nil
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 06 06:03:31 GMT 2023
    - 2.2K bytes
    - Viewed (0)
  7. clause/order_by_test.go

    		},
    		{
    			[]clause.Interface{
    				clause.Select{}, clause.From{}, clause.OrderBy{
    					Expression: clause.Expr{SQL: "FIELD(id, ?)", Vars: []interface{}{[]int{1, 2, 3}}, WithoutParentheses: true},
    				},
    			},
    			"SELECT * FROM `users` ORDER BY FIELD(id, ?,?,?)",
    			[]interface{}{1, 2, 3},
    		},
    	}
    
    	for idx, result := range results {
    		t.Run(fmt.Sprintf("case #%v", idx), func(t *testing.T) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.6K bytes
    - Viewed (0)
  8. 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)
  9. schema/schema.go

    		}
    
    		bindName := field.BindName()
    		if field.DBName != "" {
    			// nonexistence or shortest path or first appear prioritized if has permission
    			if v, ok := schema.FieldsByDBName[field.DBName]; !ok || ((field.Creatable || field.Updatable || field.Readable) && len(field.BindNames) < len(v.BindNames)) {
    				if _, ok := schema.FieldsByDBName[field.DBName]; !ok {
    					schema.DBNames = append(schema.DBNames, field.DBName)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Oct 10 06:50:29 GMT 2023
    - 13.7K bytes
    - Viewed (0)
  10. 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)
Back to top