Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for Malone (0.19 sec)

  1. tests/associations_has_one_test.go

    		t.Errorf("account's number should not be saved")
    	}
    }
    
    func TestHasOneAssociationForSlice(t *testing.T) {
    	users := []User{
    		*GetUser("slice-hasone-1", Config{Account: true}),
    		*GetUser("slice-hasone-2", Config{Account: false}),
    		*GetUser("slice-hasone-3", Config{Account: true}),
    	}
    
    	DB.Create(&users)
    
    	// Count
    	AssertAssociationCount(t, users, "Account", 2, "")
    
    	// Find
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 6.8K bytes
    - Viewed (0)
  2. migrator/migrator.go

    	if uni, ok := uniqueConstraints[name]; ok {
    		return &uni, stmt.Table
    	}
    
    	getTable := func(rel *schema.Relationship) string {
    		switch rel.Type {
    		case schema.HasOne, schema.HasMany:
    			return rel.FieldSchema.Table
    		case schema.Many2Many:
    			return rel.JoinTable.Table
    		}
    		return stmt.Table
    	}
    
    	for _, rel := range stmt.Schema.Relationships.Relations {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  3. callbacks/associations.go

    		if db.Error == nil && db.Statement.Schema != nil {
    			selectColumns, restricted := db.Statement.SelectAndOmitColumns(create, !create)
    
    			// Save Has One associations
    			for _, rel := range db.Statement.Schema.Relationships.HasOne {
    				if v, ok := selectColumns[rel.Name]; (ok && !v) || (!ok && restricted) {
    					continue
    				}
    
    				switch db.Statement.ReflectValue.Kind() {
    				case reflect.Slice, reflect.Array:
    					var (
    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)
  4. statement_test.go

    			s := new(Statement)
    			for w := 0; w < whereCount; w++ {
    				s = s.clone()
    				s.AddClause(clause.Where{
    					Exprs: s.BuildCondition(fmt.Sprintf("where%d", w)),
    				})
    			}
    
    			s1 := s.clone()
    			s1.AddClause(clause.Where{
    				Exprs: s.BuildCondition("FINAL1"),
    			})
    			s2 := s.clone()
    			s2.AddClause(clause.Where{
    				Exprs: s.BuildCondition("FINAL2"),
    			})
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Dec 23 13:19:41 GMT 2023
    - 1.9K bytes
    - Viewed (0)
  5. schema/schema_test.go

    			f.Creatable = true
    			f.Updatable = true
    			f.Readable = true
    		})
    	}
    
    	// check relations
    	relations := []Relation{
    		{
    			Name: "Account", Type: schema.HasOne, Schema: "User", FieldSchema: "Account",
    			References: []Reference{{"ID", "User", "UserID", "Account", "", true}},
    		},
    		{
    			Name: "Pets", Type: schema.HasMany, Schema: "User", FieldSchema: "Pet",
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 12.9K bytes
    - Viewed (0)
  6. statement.go

    			stmt.TableExpr = &clause.Expr{SQL: stmt.Quote(stmt.Schema.Table)}
    			stmt.Table = tables[1]
    			return
    		}
    
    		stmt.Table = stmt.Schema.Table
    	}
    	return err
    }
    
    func (stmt *Statement) clone() *Statement {
    	newStmt := &Statement{
    		TableExpr:            stmt.TableExpr,
    		Table:                stmt.Table,
    		Model:                stmt.Model,
    		Unscoped:             stmt.Unscoped,
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
  7. 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)
    	}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.9K bytes
    - Viewed (0)
  8. gorm.go

    	if sqldb, ok := connPool.(*sql.DB); ok && sqldb != nil {
    		return sqldb, nil
    	}
    
    	return nil, ErrInvalidDB
    }
    
    func (db *DB) getInstance() *DB {
    	if db.clone > 0 {
    		tx := &DB{Config: db.Config, Error: db.Error}
    
    		if db.clone == 1 {
    			// clone with new statement
    			tx.Statement = &Statement{
    				DB:        tx,
    				ConnPool:  db.Statement.ConnPool,
    				Context:   db.Statement.Context,
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sun Aug 20 11:46:56 GMT 2023
    - 11.6K bytes
    - Viewed (0)
  9. schema/relationship.go

    		}
    
    		switch field.IndirectFieldType.Kind() {
    		case reflect.Struct:
    			relation.Type = HasOne
    		case reflect.Slice:
    			relation.Type = HasMany
    		}
    	}
    
    	if schema.err == nil {
    		schema.setRelation(relation)
    		switch relation.Type {
    		case HasOne:
    			schema.Relationships.HasOne = append(schema.Relationships.HasOne, relation)
    		case HasMany:
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 22.4K bytes
    - Viewed (0)
  10. association.go

    	}
    	return association.Error
    }
    
    func (association *Association) Append(values ...interface{}) error {
    	if association.Error == nil {
    		switch association.Relationship.Type {
    		case schema.HasOne, schema.BelongsTo:
    			if len(values) > 0 {
    				association.Error = association.Replace(values...)
    			}
    		default:
    			association.saveAssociation( /*clear*/ false, values...)
    		}
    	}
    
    	return association.Error
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu May 04 11:30:45 GMT 2023
    - 21.2K bytes
    - Viewed (0)
Back to top