Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 26 for interface (0.17 sec)

  1. scan.go

    			if columnType.ScanType() != nil {
    				values[idx] = reflect.New(reflect.PtrTo(columnType.ScanType())).Interface()
    			} else {
    				values[idx] = new(interface{})
    			}
    		}
    	} else {
    		for idx := range columns {
    			values[idx] = new(interface{})
    		}
    	}
    }
    
    func scanIntoMap(mapValue map[string]interface{}, values []interface{}, columns []string) {
    	for idx, column := range columns {
    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)
  2. tests/create_test.go

    func TestCreateFromMapWithoutPK(t *testing.T) {
    	if !isMysql() {
    		t.Skipf("This test case skipped, because of only supporting for mysql")
    	}
    
    	// case 1: one record, create from map[string]interface{}
    	mapValue1 := map[string]interface{}{"name": "create_from_map_with_schema1", "age": 1}
    	if err := DB.Model(&User{}).Create(mapValue1).Error; err != nil {
    		t.Fatalf("failed to create data from map, got error: %v", err)
    	}
    
    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. schema/relationship_test.go

    package schema_test
    
    import (
    	"sync"
    	"testing"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/schema"
    )
    
    func checkStructRelation(t *testing.T, data interface{}, relations ...Relation) {
    	if s, err := schema.Parse(data, &sync.Map{}, schema.NamingStrategy{}); err != nil {
    		t.Errorf("Failed to parse schema, got error %v", err)
    	} else {
    		for _, rel := range relations {
    			checkSchemaRelation(t, s, rel)
    		}
    	}
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 25.5K bytes
    - Viewed (0)
  4. migrator/migrator.go

    	gorm.Dialector
    }
    
    type printSQLLogger struct {
    	logger.Interface
    }
    
    func (l *printSQLLogger) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error) {
    	sql, _ := fc()
    	fmt.Println(sql + ";")
    	l.Interface.Trace(ctx, begin, fc, err)
    }
    
    // GormDataTypeInterface gorm data type interface
    type GormDataTypeInterface interface {
    	GormDBDataType(*gorm.DB, *schema.Field) string
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  5. chainable_api.go

    //
    // [docs]: https://gorm.io/docs/sql_builder.html#Clauses
    func (db *DB) Clauses(conds ...clause.Expression) (tx *DB) {
    	tx = db.getInstance()
    	var whereConds []interface{}
    
    	for _, cond := range conds {
    		if c, ok := cond.(clause.Interface); ok {
    			tx.Statement.AddClause(c)
    		} else if optimizer, ok := cond.(StatementModifier); ok {
    			optimizer.ModifyStatement(tx.Statement)
    		} else {
    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)
  6. finisher_api.go

    						}
    					}
    				} else if andCond, ok := expr.(clause.AndConditions); ok {
    					db.assignInterfacesToValue(andCond.Exprs)
    				}
    			}
    		case clause.Expression, map[string]string, map[interface{}]interface{}, map[string]interface{}:
    			if exprs := db.Statement.BuildCondition(value); len(exprs) > 0 {
    				db.assignInterfacesToValue(exprs)
    			}
    		default:
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  7. callbacks/create.go

    		switch values := db.Statement.Dest.(type) {
    		case map[string]interface{}:
    			values[pkFieldName] = insertID
    		case *map[string]interface{}:
    			(*values)[pkFieldName] = insertID
    		case []map[string]interface{}, *[]map[string]interface{}:
    			mapValues, ok := values.([]map[string]interface{})
    			if !ok {
    				if v, ok := values.(*[]map[string]interface{}); ok {
    					if *v != nil {
    						mapValues = *v
    					}
    				}
    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)
  8. callbacks/associations.go

    							db.AddError(ref.ForeignKey.Set(db.Statement.Context, obj, pv))
    
    							if dest, ok := db.Statement.Dest.(map[string]interface{}); ok {
    								dest[ref.ForeignKey.DBName] = pv
    								if _, ok := dest[rel.Name]; ok {
    									dest[rel.Name] = elem.Interface()
    								}
    							}
    						}
    					}
    				}
    
    				switch db.Statement.ReflectValue.Kind() {
    				case reflect.Slice, reflect.Array:
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Apr 11 03:06:13 GMT 2023
    - 14.3K bytes
    - Viewed (0)
  9. tests/hooks_test.go

    	}
    
    	DB.Model(&product).Select("code", "price").Updates(map[string]interface{}{"code": "L1212"})
    
    	if product.Price != 150 || product.Code != "L1212" {
    		t.Errorf("invalid data after update, got %+v", product)
    	}
    
    	// Code not changed, price should not change
    	DB.Model(&product).Updates(map[string]interface{}{"Name": "Product New"})
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 15.9K bytes
    - Viewed (0)
  10. callbacks/query.go

    				for idx, dbName := range db.Statement.Schema.DBNames {
    					clauseSelect.Columns[idx] = clause.Column{Table: db.Statement.Table, Name: dbName}
    				}
    			}
    
    			specifiedRelationsName := make(map[string]interface{})
    			for _, join := range db.Statement.Joins {
    				if db.Statement.Schema != nil {
    					var isRelations bool // is relations or raw sql
    					var relations []*schema.Relationship
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Jan 29 03:34:57 GMT 2024
    - 9.9K bytes
    - Viewed (0)
Back to top