- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 15 for scwang (0.31 sec)
-
tests/scan_test.go
if res.ID != user3.ID || res.Name != user3.Name || res.Age != int(user3.Age) { t.Fatalf("Scan into struct should work, got %#v, should %#v", res, user3) } doubleAgeRes := &result{} if err := DB.Table("users").Select("age + age as age").Where("id = ?", user3.ID).Scan(&doubleAgeRes).Error; err != nil { t.Errorf("Scan to pointer of pointer") } if doubleAgeRes.Age != int(res.Age)*2 {
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Sat May 28 14:18:07 GMT 2022 - 8.2K bytes - Viewed (0) -
soft_delete.go
"encoding/json" "reflect" "github.com/jinzhu/now" "gorm.io/gorm/clause" "gorm.io/gorm/schema" ) type DeletedAt sql.NullTime // Scan implements the Scanner interface. func (n *DeletedAt) Scan(value interface{}) error { return (*sql.NullTime)(n).Scan(value) } // Value implements the driver Valuer interface. func (n DeletedAt) Value() (driver.Value, error) { if !n.Valid { return nil, nil }
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Wed Feb 01 06:40:55 GMT 2023 - 4.5K bytes - Viewed (0) -
tests/scopes_test.go
} var maxId int64 userTable := func(db *gorm.DB) *gorm.DB { return db.WithContext(context.Background()).Table("users") } if err := DB.Scopes(userTable).Select("max(id)").Scan(&maxId).Error; err != nil { t.Errorf("select max(id)") } } func TestComplexScopes(t *testing.T) { tests := []struct { name string queryFn func(tx *gorm.DB) *gorm.DB expected string }{
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Fri Jan 12 08:42:21 GMT 2024 - 3.3K bytes - Viewed (0) -
tests/connection_test.go
if len(setSQL) == 0 || len(getSQL) == 0 { return } err := DB.Connection(func(tx *gorm.DB) error { if err := tx.Exec(setSQL, expectedName).Error; err != nil { return err } if err := tx.Raw(getSQL).Scan(&actualName).Error; err != nil { return err } return nil }) if err != nil { t.Errorf(fmt.Sprintf("WithSingleConnection should work, but got err %v", err)) } if actualName != expectedName {
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Fri Jan 28 14:16:42 GMT 2022 - 963 bytes - Viewed (0) -
interfaces.go
type GetDBConnector interface { GetDBConn() (*sql.DB, error) } // Rows rows interface type Rows interface { Columns() ([]string, error) ColumnTypes() ([]*sql.ColumnType, error) Next() bool Scan(dest ...interface{}) error Err() error Close() error } type ErrorTranslator interface { Translate(err error) error
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Sat Aug 19 13:33:31 GMT 2023 - 2.2K bytes - Viewed (0) -
tests/serializer_test.go
} return s } type Roles []string type Job struct { Title string Number int Location string IsIntern bool } type EncryptedString string func (es *EncryptedString) Scan(ctx context.Context, field *schema.Field, dst reflect.Value, dbValue interface{}) (err error) { switch value := dbValue.(type) { case []byte: *es = EncryptedString(bytes.TrimPrefix(value, []byte("hello"))) case string:
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Fri Apr 21 14:09:38 GMT 2023 - 7.6K bytes - Viewed (0) -
callbacks/update.go
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Mon Mar 18 05:44:55 GMT 2024 - 9.4K bytes - Viewed (1) -
tests/group_by_test.go
t.Errorf("no error should happen, but got %v", err) } if name != "groupby" || total != 60 { t.Errorf("name should be groupby, but got %v, total should be 60, but got %v", name, total) } if err := DB.Model(&User{}).Select("name, sum(age)").Where("name = ?", "groupby").Group("users.name").Row().Scan(&name, &total); err != nil {
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Thu Jan 06 07:02:53 GMT 2022 - 3.3K bytes - Viewed (0) -
schema/interfaces.go
GetName() string Build() (sql string, vars []interface{}) } // GormDataTypeInterface gorm data type interface type GormDataTypeInterface interface { GormDataType() string } // FieldNewValuePool field new scan value pool type FieldNewValuePool interface { Get() interface{} Put(interface{}) } // CreateClausesInterface create clauses interface type CreateClausesInterface interface {
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Sun Feb 04 07:49:19 GMT 2024 - 980 bytes - Viewed (0) -
migrator/column_type.go
// Unique reports whether the column may be unique. func (ct ColumnType) Unique() (unique bool, ok bool) { return ct.UniqueValue.Bool, ct.UniqueValue.Valid } // ScanType returns a Go type suitable for scanning into using Rows.Scan. func (ct ColumnType) ScanType() reflect.Type { if ct.ScanTypeValue != nil { return ct.ScanTypeValue } return ct.SQLColumnType.ScanType() } // Comment returns the comment of current column.
Go - Registered: Sun Apr 28 09:35:09 GMT 2024 - Last Modified: Thu Mar 24 01:31:58 GMT 2022 - 3.3K bytes - Viewed (0)