Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 22 for ramble (0.22 sec)

  1. tests/create_test.go

    	}
    
    	// case 3: create from []map[string]interface{}
    	records := []map[string]interface{}{
    		{"name": "create_from_map_with_table_2", "age": 19},
    		{"name": "create_from_map_with_table_3", "age": 20},
    	}
    
    	tableDB = DB.Table("users")
    	if err := tableDB.Create(&records).Error; err != nil {
    		t.Fatalf("failed to create data from slice of 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)
  2. tests/joins_test.go

    	}
    
    	iv := DB.Table(`table_invoices`).Select(`seller, SUM(total) as total, SUM(paid) as paid, SUM(balance) as balance`).Group(`seller`)
    	stmt = dryDB.Table(`table_employees`).Select(`id, name, iv.total, iv.paid, iv.balance`).Joins(`LEFT JOIN (?) AS iv ON iv.seller = table_employees.id`, iv).Scan(&user).Statement
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 26 14:19:32 GMT 2023
    - 13.5K bytes
    - Viewed (1)
  3. schema/relationship_test.go

    		JoinTable: JoinTable{Name: "user_profiles", Table: "user_profiles"},
    		References: []Reference{
    			{"Refer", "User", "UserReferID", "user_profiles", "", true},
    			{"UserRefer", "Profile", "ProfileRefer", "user_profiles", "", false},
    		},
    	}, Relation{
    		Name: "Profiles2", Type: schema.Many2Many, Schema: "User", FieldSchema: "Profile",
    		JoinTable: JoinTable{Name: "user_profiles2", Table: "user_profiles2"},
    		References: []Reference{
    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

    	stmt := &gorm.Statement{DB: m.DB}
    	if m.DB.Statement != nil {
    		stmt.Table = m.DB.Statement.Table
    		stmt.TableExpr = m.DB.Statement.TableExpr
    	}
    
    	if table, ok := value.(string); ok {
    		stmt.Table = table
    	} else if err := stmt.ParseWithSpecialTableName(value, stmt.Table); err != nil {
    		return err
    	}
    
    	return fc(stmt)
    }
    
    // DataTypeOf return field's db data type
    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. callbacks/query.go

    										Column: clause.Column{Table: parentTableName, Name: ref.PrimaryKey.DBName},
    										Value:  clause.Column{Table: tableAliasName, Name: ref.ForeignKey.DBName},
    									}
    								} else {
    									if ref.PrimaryValue == "" {
    										exprs[idx] = clause.Eq{
    											Column: clause.Column{Table: parentTableName, Name: ref.ForeignKey.DBName},
    											Value:  clause.Column{Table: tableAliasName, Name: ref.PrimaryKey.DBName},
    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)
  6. chainable_api.go

    	}
    	return
    }
    
    var tableRegexp = regexp.MustCompile(`(?i)(?:.+? AS (\w+)\s*(?:$|,)|^\w+\s+(\w+)$)`)
    
    // Table specify the table you would like to run db operations
    //
    //	// Get a user
    //	db.Table("users").Take(&result)
    func (db *DB) Table(name string, args ...interface{}) (tx *DB) {
    	tx = db.getInstance()
    	if strings.Contains(name, " ") || strings.Contains(name, "`") || len(args) > 0 {
    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)
  7. tests/table_test.go

    		t.Errorf("Table with escape character, got %v", r.Statement.SQL.String())
    	}
    
    	r = dryDB.Table("`people`").Table("`user`").Find(&User{}).Statement
    	if !regexp.MustCompile("SELECT \\* FROM `user`").MatchString(r.Statement.SQL.String()) {
    		t.Errorf("Table with escape character, got %v", r.Statement.SQL.String())
    	}
    
    	r = dryDB.Table("people as p").Table("user as u").Find(&User{}).Statement
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Mar 09 09:31:28 GMT 2024
    - 10.6K bytes
    - Viewed (0)
  8. tests/upsert_test.go

    		if !regexp.MustCompile(`INTO .restricted_languages. .*\(.code.,.name.,.lang.\) .* (SET|UPDATE) .name.=.*.name.\W*$`).MatchString(r.Statement.SQL.String()) {
    			t.Errorf("Table with escape character, got %v", r.Statement.SQL.String())
    		}
    	}
    
    	user := *GetUser("upsert_on_conflict", Config{})
    	user.Age = 20
    	if err := DB.Create(&user).Error; err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Sep 05 07:39:19 GMT 2022
    - 11.4K bytes
    - Viewed (0)
  9. tests/update_test.go

    	DB.First(&result2, "code = ?", "save")
    	AssertEqual(t, result2, lang)
    
    	DB.Table("langs").Migrator().DropTable(&Language{})
    	DB.Table("langs").AutoMigrate(&Language{})
    
    	if err := DB.Table("langs").Save(&lang).Error; err != nil {
    		t.Errorf("no error should happen when creating data, but got %v", err)
    	}
    
    	var result3 Language
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Dec 04 03:50:58 GMT 2023
    - 30.3K bytes
    - Viewed (0)
  10. tests/transaction_test.go

    		t.Fatalf("Should find saved record, but got %v", err)
    	}
    
    	tx2.Commit()
    
    	if err := DB.First(&User{}, "name = ?", "transaction-2").Error; err != nil {
    		t.Fatalf("Should be able to find committed record, but got %v", err)
    	}
    
    	t.Run("this is test nested transaction and prepareStmt coexist case", func(t *testing.T) {
    		// enable prepare statement
    		tx3 := DB.Session(&gorm.Session{PrepareStmt: true})
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 10.9K bytes
    - Viewed (0)
Back to top