- Sort Score
- Result 10 results
- Languages All
Results 1 - 6 of 6 for Pluck (0.05 sec)
-
tests/query_test.go
func TestPluck(t *testing.T) { users := []*User{ GetUser("pluck-user1", Config{}), GetUser("pluck-user2", Config{}), GetUser("pluck-user3", Config{}), } DB.Create(&users) var names []string if err := DB.Model(User{}).Where("name like ?", "pluck-user%").Order("name").Pluck("name", &names).Error; err != nil { t.Errorf("got error when pluck name: %v", err) } var names2 []string
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 24 09:42:59 UTC 2024 - 50.4K bytes - Viewed (0) -
tests/distinct_test.go
} var names []string DB.Table("users").Where("name like ?", "distinct%").Order("name").Pluck("name", &names) AssertEqual(t, names, []string{"distinct", "distinct", "distinct", "distinct-2", "distinct-3"}) var names1 []string DB.Model(&User{}).Where("name like ?", "distinct%").Distinct().Order("name").Pluck("Name", &names1) AssertEqual(t, names1, []string{"distinct", "distinct-2", "distinct-3"})
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jan 06 07:02:53 UTC 2022 - 2.5K bytes - Viewed (0) -
tests/main_test.go
t.Skip("skip sqlserver due to it will raise data race for invalid sql") } var columns []string if DB.Where("sdsd.zaaa = ?", "sd;;;aa").Pluck("aaa", &columns).Error == nil { t.Errorf("Should got error with invalid SQL") } if DB.Model(&User{}).Where("sdsd.zaaa = ?", "sd;;;aa").Pluck("aaa", &columns).Error == nil { t.Errorf("Should got error with invalid SQL") }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Mar 24 01:31:58 UTC 2022 - 1.4K bytes - Viewed (0) -
scan.go
} if len(columns) == 1 { // Is Pluck if _, ok := reflect.New(reflectValueType).Interface().(sql.Scanner); (reflectValueType != sch.ModelType && ok) || // is scanner reflectValueType.Kind() != reflect.Struct || // is not struct sch.ModelType.ConvertibleTo(schema.TimeReflectType) { // is time sch = nil } } // Not Pluck if sch != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 24 09:42:59 UTC 2024 - 10.1K bytes - Viewed (0) -
finisher_api.go
return newLogger.SQL, tx.RowsAffected }, tx.Error) tx.Logger = currentLogger return } // Pluck queries a single column from a model, returning in the slice dest. E.g.: // // var ages []int64 // db.Model(&users).Pluck("age", &ages) func (db *DB) Pluck(column string, dest interface{}) (tx *DB) { tx = db.getInstance() if tx.Statement.Model != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Sat Sep 14 12:58:29 UTC 2024 - 22.8K bytes - Viewed (0) -
compat/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/reflection/ClassMap.java
// Short circuit for the (hopefully) majority of cases where the // clazz is public if (Modifier.isPublic(clazz.getModifiers())) { return methods; } // No luck - the class is not public, so we're going the longer way. MethodInfo[] methodInfos = new MethodInfo[methods.length]; for (int i = methods.length; i-- > 0; ) { methodInfos[i] = new MethodInfo(methods[i]);
Registered: Sun Nov 03 03:35:11 UTC 2024 - Last Modified: Fri Oct 25 12:31:46 UTC 2024 - 13.5K bytes - Viewed (0)