Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 50 for Append (0.14 sec)

  1. prepare_stmt.go

    	if err != nil {
    		cacheStmt.prepareErr = err
    		db.Mux.Lock()
    		delete(db.Stmts, query)
    		db.Mux.Unlock()
    		return Stmt{}, err
    	}
    
    	db.Mux.Lock()
    	cacheStmt.Stmt = stmt
    	db.PreparedSQL = append(db.PreparedSQL, query)
    	db.Mux.Unlock()
    
    	return cacheStmt, nil
    }
    
    func (db *PreparedStmtDB) BeginTx(ctx context.Context, opt *sql.TxOptions) (ConnPool, error) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 28 08:47:39 GMT 2024
    - 6.4K bytes
    - Viewed (0)
  2. tests/migrate_test.go

    	if err := DB.Order("id ASC").Find(&rows).Error; err != nil {
    		t.Fatalf("find auto_increment_struct fail, err: %v", err)
    	}
    
    	ids := make([]int64, 0, len(rows))
    	for _, row := range rows {
    		ids = append(ids, row.ID)
    	}
    	lastID := ids[len(ids)-1]
    
    	if err := DB.Where("id IN (?)", ids).Delete(&AutoIncrementStruct{}).Error; err != nil {
    		t.Fatalf("delete auto_increment_struct fail, err: %v", err)
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  3. tests/scan_test.go

    		Age  int
    	}
    
    	var results []Result
    	for rows.Next() {
    		var result Result
    		if err := DB.ScanRows(rows, &result); err != nil {
    			t.Errorf("should get no error, but got %v", err)
    		}
    		results = append(results, result)
    	}
    
    	sort.Slice(results, func(i, j int) bool {
    		return strings.Compare(results[i].Name, results[j].Name) <= -1
    	})
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat May 28 14:18:07 GMT 2022
    - 8.2K bytes
    - Viewed (0)
  4. tests/associations_belongs_to_test.go

    	}
    
    	// Append
    	DB.Model(&users).Association("Company").Append(
    		&Company{Name: "company-slice-append-1"},
    		&Company{Name: "company-slice-append-2"},
    		&Company{Name: "company-slice-append-3"},
    	)
    
    	AssertAssociationCount(t, users, "Company", 3, "After Append")
    
    	DB.Model(&users).Association("Manager").Append(
    		GetUser("manager-slice-belongs-to-1", Config{}),
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 9.3K bytes
    - Viewed (0)
  5. callbacks/preload.go

    			if ref.OwnPrimaryKey {
    				joinForeignKeys = append(joinForeignKeys, ref.ForeignKey.DBName)
    				joinForeignFields = append(joinForeignFields, ref.ForeignKey)
    				foreignFields = append(foreignFields, ref.PrimaryKey)
    			} else if ref.PrimaryValue != "" {
    				tx = tx.Where(clause.Eq{Column: ref.ForeignKey.DBName, Value: ref.PrimaryValue})
    			} else {
    				joinRelForeignFields = append(joinRelForeignFields, ref.ForeignKey)
    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)
  6. tests/named_polymorphic_test.go

    	if hamsterToy.Name != hamster.OtherToy.Name {
    		t.Errorf("Should find has one polymorphic association")
    	}
    
    	// Append
    	DB.Model(&hamster).Association("PreferredToy").Append(&Toy{
    		Name: "bike 2",
    	})
    
    	DB.Model(&hamster).Association("OtherToy").Append(&Toy{
    		Name: "treadmill 2",
    	})
    
    	hamsterToy = Toy{}
    	DB.Model(&hamster).Association("PreferredToy").Find(&hamsterToy)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jul 08 09:59:40 GMT 2020
    - 4.2K bytes
    - Viewed (0)
  7. statement.go

    							where.Exprs[0] = clause.AndConditions(orConds)
    						}
    					}
    					conds = append(conds, clause.And(where.Exprs...))
    				} else if cs.Expression != nil {
    					conds = append(conds, cs.Expression)
    				}
    			}
    		case map[interface{}]interface{}:
    			for i, j := range v {
    				conds = append(conds, clause.Eq{Column: i, Value: j})
    			}
    		case map[string]string:
    			keys := make([]string, 0, len(v))
    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)
  8. tests/multi_primary_keys_test.go

    	}
    
    	// Append
    	tag3 := &Tag{Locale: "ZH", Value: "tag3"}
    	DB.Model(&blog).Association("Tags").Append([]*Tag{tag3})
    
    	if !compareTags(blog.Tags, []string{"tag1", "tag2", "tag3"}) {
    		t.Fatalf("Blog should has three tags after Append")
    	}
    
    	if count := DB.Model(&blog).Association("Tags").Count(); count != 3 {
    		t.Fatalf("Blog should has 3 tags after Append, got %v", count)
    	}
    
    	var tags []Tag
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 12.8K bytes
    - Viewed (0)
  9. callbacks/update.go

    							set = append(set, clause.Assignment{Column: clause.Column{Name: field.DBName}, Value: now.UnixNano()})
    						} else if field.AutoUpdateTime == schema.UnixMillisecond {
    							set = append(set, clause.Assignment{Column: clause.Column{Name: field.DBName}, Value: now.UnixMilli()})
    						} else if field.AutoUpdateTime == schema.UnixSecond {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 05:44:55 GMT 2024
    - 9.4K bytes
    - Viewed (1)
  10. 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})
    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)
Back to top