- Sort Score
- Result 10 results
- Languages All
Results 31 - 40 of 1,127 for gorm (0.05 sec)
-
tests/soft_delete_test.go
package tests_test import ( "database/sql" "encoding/json" "errors" "regexp" "testing" "github.com/jinzhu/now" "gorm.io/gorm" . "gorm.io/gorm/utils/tests" ) func TestSoftDelete(t *testing.T) { user := *GetUser("SoftDelete", Config{}) DB.Save(&user) var count int64 var age uint if DB.Model(&User{}).Where("name = ?", user.Name).Count(&count).Error != nil || count != 1 {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Feb 01 06:40:55 UTC 2023 - 5.7K bytes - Viewed (0) -
tests/gorm_test.go
package tests_test import ( "testing" "gorm.io/driver/mysql" "gorm.io/gorm" ) func TestOpen(t *testing.T) { dsn := "gorm:gorm@tcp(localhost:9910)/gorm?loc=Asia%2FHongKong" // invalid loc _, err := gorm.Open(mysql.Open(dsn), &gorm.Config{}) if err == nil { t.Fatalf("should returns error but got nil") } } func TestReturningWithNullToZeroValues(t *testing.T) { dialect := DB.Dialector.Name() switch dialect {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jun 01 07:22:21 UTC 2023 - 3.3K bytes - Viewed (0) -
callbacks/create_test.go
package callbacks import ( "reflect" "sync" "testing" "time" "gorm.io/gorm" "gorm.io/gorm/clause" "gorm.io/gorm/schema" ) var schemaCache = &sync.Map{} func TestConvertToCreateValues_DestType_Slice(t *testing.T) { type user struct { ID int `gorm:"primaryKey"` Name string Email string `gorm:"default:(-)"` Age int `gorm:"default:(-)"` }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Mar 18 05:48:42 UTC 2024 - 1.4K bytes - Viewed (0) -
tests/update_belongs_to_test.go
package tests_test import ( "testing" "gorm.io/gorm" . "gorm.io/gorm/utils/tests" ) func TestUpdateBelongsTo(t *testing.T) { user := *GetUser("update-belongs-to", Config{}) if err := DB.Create(&user).Error; err != nil { t.Fatalf("errors happened when create: %v", err) } user.Company = Company{Name: "company-belongs-to-association"} user.Manager = &User{Name: "manager-belongs-to-association"}
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jul 14 06:55:54 UTC 2022 - 1.6K bytes - Viewed (0) -
tests/connpool_test.go
package tests_test import ( "context" "database/sql" "os" "reflect" "testing" "gorm.io/driver/mysql" "gorm.io/gorm" . "gorm.io/gorm/utils/tests" ) type wrapperTx struct { *sql.Tx conn *wrapperConnPool } func (c *wrapperTx) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) { c.conn.got = append(c.conn.got, query) return c.Tx.PrepareContext(ctx, query) }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Feb 06 02:54:40 UTC 2024 - 5.5K bytes - Viewed (0) -
tests/prepared_stmt_test.go
package tests_test import ( "context" "errors" "sync" "sync/atomic" "testing" "time" "gorm.io/gorm" . "gorm.io/gorm/utils/tests" ) func TestPreparedStmt(t *testing.T) { tx := DB.Session(&gorm.Session{PrepareStmt: true}) if _, ok := tx.ConnPool.(*gorm.PreparedStmtDB); !ok { t.Fatalf("should assign PreparedStatement Manager back to database when using PrepareStmt mode") }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Aug 22 11:02:05 UTC 2024 - 8.5K bytes - Viewed (0) -
model.go
package gorm import "time" // Model a basic GoLang struct which includes the following fields: ID, CreatedAt, UpdatedAt, DeletedAt // It may be embedded into your model or you may build your own model without it // // type User struct { // gorm.Model // } type Model struct { ID uint `gorm:"primarykey"` CreatedAt time.Time UpdatedAt time.Time DeletedAt DeletedAt `gorm:"index"`
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Sat Feb 18 01:06:43 UTC 2023 - 396 bytes - Viewed (0) -
tests/preload_test.go
package tests_test import ( "context" "encoding/json" "regexp" "sort" "strconv" "sync" "testing" "time" "gorm.io/gorm" "gorm.io/gorm/clause" . "gorm.io/gorm/utils/tests" ) func TestPreloadWithAssociations(t *testing.T) { user := *GetUser("preload_with_associations", Config{ Account: true, Pets: 2, Toys: 3, Company: true, Manager: true, Team: 4,
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:00:47 UTC 2024 - 15.9K bytes - Viewed (0) -
tests/count_test.go
package tests_test import ( "fmt" "regexp" "sort" "strings" "testing" "gorm.io/gorm" . "gorm.io/gorm/utils/tests" ) func TestCountWithGroup(t *testing.T) { DB.Create([]Company{ {Name: "company_count_group_a"}, {Name: "company_count_group_a"}, {Name: "company_count_group_a"}, {Name: "company_count_group_b"}, {Name: "company_count_group_c"}, }) var count1 int64
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Oct 30 09:15:49 UTC 2023 - 6.9K bytes - Viewed (0) -
tests/update_many2many_test.go
package tests_test import ( "testing" "gorm.io/gorm" . "gorm.io/gorm/utils/tests" ) func TestUpdateMany2ManyAssociations(t *testing.T) { user := *GetUser("update-many2many", Config{}) if err := DB.Create(&user).Error; err != nil { t.Fatalf("errors happened when create: %v", err) } user.Languages = []Language{{Code: "zh-CN", Name: "Chinese"}, {Code: "en", Name: "English"}} for _, lang := range user.Languages {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jan 06 07:02:53 UTC 2022 - 1.3K bytes - Viewed (0)