- Sort Score
- Result 10 results
- Languages All
Results 101 - 110 of 1,127 for gorm (0.07 sec)
-
callbacks/helper_test.go
package callbacks import ( "reflect" "testing" "gorm.io/gorm" "gorm.io/gorm/clause" ) func TestLoadOrStoreVisitMap(t *testing.T) { var vm visitMap var loaded bool type testM struct { Name string } t1 := testM{Name: "t1"} t2 := testM{Name: "t2"} t3 := testM{Name: "t3"} vm = make(visitMap) if loaded = loadOrStoreVisitMap(&vm, reflect.ValueOf(&t1)); loaded {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Mar 05 02:22:57 UTC 2024 - 3.4K bytes - Viewed (0) -
schema/constraint.go
package schema import ( "regexp" "strings" "gorm.io/gorm/clause" ) // reg match english letters and midline var regEnLetterAndMidline = regexp.MustCompile(`^[\w-]+$`) type CheckConstraint struct { Name string Constraint string // length(phone) >= 10 *Field } func (chk *CheckConstraint) GetName() string { return chk.Name } func (chk *CheckConstraint) Build() (sql string, vars []interface{}) {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Mar 18 07:33:54 UTC 2024 - 1.9K bytes - Viewed (0) -
tests/benchmark_test.go
package tests_test import ( "fmt" "testing" . "gorm.io/gorm/utils/tests" ) func BenchmarkCreate(b *testing.B) { user := *GetUser("bench", Config{}) for x := 0; x < b.N; x++ { user.ID = 0 DB.Create(&user) } } func BenchmarkFind(b *testing.B) { user := *GetUser("find", Config{}) DB.Create(&user) for x := 0; x < b.N; x++ { DB.Find(&User{}, "id = ?", user.ID) } }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 01 03:50:57 UTC 2022 - 1.5K bytes - Viewed (0) -
finisher_api.go
package gorm import ( "database/sql" "errors" "fmt" "hash/maphash" "reflect" "strings" "gorm.io/gorm/clause" "gorm.io/gorm/logger" "gorm.io/gorm/schema" "gorm.io/gorm/utils" ) // Create inserts value, returning the inserted data's primary key in value's id func (db *DB) Create(value interface{}) (tx *DB) { if db.CreateBatchSize > 0 { return db.CreateInBatches(value, db.CreateBatchSize) }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Sat Sep 14 12:58:29 UTC 2024 - 22.8K bytes - Viewed (0) -
tests/tracer_test.go
package tests_test import ( "context" "time" "gorm.io/gorm/logger" ) type Tracer struct { Logger logger.Interface Test func(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error) } func (S Tracer) LogMode(level logger.LogLevel) logger.Interface { return S.Logger.LogMode(level) } func (S Tracer) Info(ctx context.Context, s string, i ...interface{}) {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Oct 18 09:28:06 UTC 2022 - 830 bytes - Viewed (0) -
tests/update_test.go
package tests_test import ( "errors" "regexp" "sort" "strings" "testing" "time" "gorm.io/gorm" "gorm.io/gorm/clause" "gorm.io/gorm/utils" . "gorm.io/gorm/utils/tests" ) func TestUpdate(t *testing.T) { var ( users = []*User{ GetUser("update-1", Config{}), GetUser("update-2", Config{}), GetUser("update-3", Config{}), } user = users[1] lastUpdatedAt time.Time )
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Dec 04 03:50:58 UTC 2023 - 30.3K bytes - Viewed (0) -
schema/schema_helper_test.go
package schema_test import ( "context" "fmt" "reflect" "strings" "testing" "gorm.io/gorm/schema" "gorm.io/gorm/utils/tests" ) func checkSchema(t *testing.T, s *schema.Schema, v schema.Schema, primaryFields []string) { t.Run("CheckSchema/"+s.Name, func(t *testing.T) { tests.AssertObjEqual(t, s, v, "Name", "Table") for idx, field := range primaryFields { var found bool for _, f := range s.PrimaryFields {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Dec 15 08:31:23 UTC 2023 - 7.5K bytes - Viewed (0) -
callbacks/row.go
package callbacks import ( "gorm.io/gorm" ) func RowQuery(db *gorm.DB) { if db.Error == nil { BuildQuerySQL(db) if db.DryRun || db.Error != nil { return } if isRows, ok := db.Get("rows"); ok && isRows.(bool) { db.Statement.Settings.Delete("rows") db.Statement.Dest, db.Error = db.Statement.ConnPool.QueryContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...) } else {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Feb 08 05:40:41 UTC 2023 - 581 bytes - Viewed (0) -
tests/scan_test.go
package tests_test import ( "reflect" "sort" "strings" "testing" "time" "gorm.io/gorm" . "gorm.io/gorm/utils/tests" ) type PersonAddressInfo struct { Person *Person `gorm:"embedded"` Address *Address `gorm:"embedded"` } func TestScan(t *testing.T) { user1 := User{Name: "ScanUser1", Age: 1} user2 := User{Name: "ScanUser2", Age: 10} user3 := User{Name: "ScanUser3", Age: 20}
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:57:36 UTC 2024 - 10.9K bytes - Viewed (0) -
tests/non_std_test.go
package tests_test import ( "testing" "time" ) type Animal struct { Counter uint64 `gorm:"primary_key:yes"` Name string `gorm:"DEFAULT:'galeone'"` From string // test reserved sql keyword as field name Age *time.Time unexported string // unexported value CreatedAt time.Time UpdatedAt time.Time } func TestNonStdPrimaryKeyAndDefaultValues(t *testing.T) { DB.Migrator().DropTable(&Animal{})
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed May 08 04:07:58 UTC 2024 - 1.9K bytes - Viewed (0)