- Sort Score
- Result 10 results
- Languages All
Results 1 - 4 of 4 for subquery_3 (0.18 sec)
-
tests/query_test.go
} func TestSubQuery(t *testing.T) { users := []User{ {Name: "subquery_1", Age: 10}, {Name: "subquery_2", Age: 20}, {Name: "subquery_3", Age: 30}, {Name: "subquery_4", Age: 40}, } DB.Create(&users) if err := DB.Select("*").Where("name IN (?)", DB.Select("name").Table("users").Where("name LIKE ?", "subquery_%")).Find(&users).Error; err != nil { t.Fatalf("got error: %v", err) }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 24 09:42:59 UTC 2024 - 50.4K bytes - Viewed (0) -
migrator.go
type ViewOption struct { Replace bool // If true, exec `CREATE`. If false, exec `CREATE OR REPLACE` CheckOption string // optional. e.g. `WITH [ CASCADED | LOCAL ] CHECK OPTION` Query *DB // required subquery. } // ColumnType column type interface type ColumnType interface { Name() string DatabaseTypeName() string // varchar ColumnType() (columnType string, ok bool) // varchar(64)
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Oct 30 09:15:49 UTC 2023 - 3.1K bytes - Viewed (0) -
tests/create_test.go
user := User{Name: "jinzhu"} DB.Create(&user) subQuery := DB.Table("users").Where("name=?", user.Name).Select("id") result := DB.Session(&gorm.Session{DryRun: true}).Model(&Pet{}).Create([]map[string]interface{}{ { "name": "cat", "user_id": gorm.Expr("(?)", DB.Table("(?) as tmp", subQuery).Select("@uid:=id")), }, { "name": "dog", "user_id": gorm.Expr("@uid"),
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Mar 19 03:50:28 UTC 2024 - 26.4K bytes - Viewed (0) -
migrator/migrator.go
// q := DB.Model(&User{}) // DB.Debug().Migrator().CreateView("user_view", gorm.ViewOption{Query: q, Replace: true, CheckOption: "WITH CHECK OPTION"}) // // [subquery]: https://gorm.io/docs/advanced_query.html#SubQuery func (m Migrator) CreateView(name string, option gorm.ViewOption) error { if option.Query == nil { return gorm.ErrSubQueryRequired } sql := new(strings.Builder)
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Apr 26 07:15:49 UTC 2024 - 29K bytes - Viewed (0)