- Sort Score
- Result 10 results
- Languages All
Results 51 - 60 of 947 for gorm (0.09 sec)
-
tests/joins_test.go
package tests_test import ( "fmt" "regexp" "sort" "testing" "github.com/stretchr/testify/assert" "gorm.io/gorm" . "gorm.io/gorm/utils/tests" ) func TestJoins(t *testing.T) { user := *GetUser("joins-1", Config{Company: true, Manager: true, Account: true, NamedPet: false}) DB.Create(&user) var user2 User
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Sun May 25 07:40:40 UTC 2025 - 15K bytes - Viewed (0) -
tests/named_argument_test.go
package tests_test import ( "database/sql" "errors" "testing" "gorm.io/gorm" . "gorm.io/gorm/utils/tests" ) func TestNamedArg(t *testing.T) { type NamedUser struct { gorm.Model Name1 string Name2 string Name3 string } DB.Migrator().DropTable(&NamedUser{}) DB.AutoMigrate(&NamedUser{}) namedUser := NamedUser{Name1: "jinzhu1", Name2: "jinzhu2", Name3: "jinzhu3"} DB.Create(&namedUser)
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Tue Dec 21 11:50:00 UTC 2021 - 2.7K bytes - Viewed (0) -
tests/update_has_many_test.go
package tests_test import ( "testing" "gorm.io/gorm" . "gorm.io/gorm/utils/tests" ) func TestUpdateHasManyAssociations(t *testing.T) { user := *GetUser("update-has-many", Config{}) if err := DB.Create(&user).Error; err != nil { t.Fatalf("errors happened when create: %v", err) } user.Pets = []*Pet{{Name: "pet1"}, {Name: "pet2"}} if err := DB.Save(&user).Error; err != nil {
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Thu Jan 06 07:02:53 UTC 2022 - 2K bytes - Viewed (0) -
tests/association_generics_test.go
package tests_test import ( "context" "testing" "gorm.io/gorm" "gorm.io/gorm/clause" . "gorm.io/gorm/utils/tests" ) // BelongsToCompany and BelongsToUser models for belongs to tests - using existing User and Company models // Test Set + Create with Association OpCreate operation using real database func TestClauseAssociationSetCreateWithOpCreate(t *testing.T) { ctx := context.Background()
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Fri Sep 12 05:42:26 UTC 2025 - 37.9K bytes - Viewed (0) -
tests/multi_primary_keys_test.go
import ( "reflect" "sort" "testing" "gorm.io/gorm" . "gorm.io/gorm/utils/tests" ) type Blog struct { ID uint `gorm:"primary_key"` Locale string `gorm:"primary_key"` Subject string Body string Tags []Tag `gorm:"many2many:blog_tags;"` SharedTags []Tag `gorm:"many2many:shared_blog_tags;ForeignKey:id;References:id"`
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Mon Jul 21 02:46:58 UTC 2025 - 13.1K bytes - Viewed (0) -
migrator.go
package gorm import ( "reflect" "gorm.io/gorm/clause" "gorm.io/gorm/schema" ) // Migrator returns migrator func (db *DB) Migrator() Migrator { tx := db.getInstance() // apply scopes to migrator for len(tx.Statement.scopes) > 0 { tx = tx.executeScopes() } return tx.Dialector.Migrator(tx.Session(&Session{})) } // AutoMigrate run auto migration for given models
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Mon Oct 30 09:15:49 UTC 2023 - 3.1K bytes - Viewed (0) -
callbacks/raw.go
package callbacks import ( "gorm.io/gorm" ) func RawExec(db *gorm.DB) { if db.Error == nil && !db.DryRun { result, err := db.Statement.ConnPool.ExecContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...) if err != nil { db.AddError(err) return } db.RowsAffected, _ = result.RowsAffected() if db.Statement.Result != nil { db.Statement.Result.Result = result
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Sun May 25 07:40:40 UTC 2025 - 468 bytes - Viewed (0) -
tests/associations_belongs_to_test.go
} func TestBelongsToAssociationUnscoped(t *testing.T) { type ItemParent struct { gorm.Model Logo string `gorm:"not null;type:varchar(50)"` } type ItemChild struct { gorm.Model Name string `gorm:"type:varchar(50)"` ItemParentID uint ItemParent ItemParent } tx := DB.Session(&gorm.Session{}) tx.Migrator().DropTable(&ItemParent{}, &ItemChild{})
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Mon Oct 30 09:15:49 UTC 2023 - 9.3K bytes - Viewed (0) -
clause/expression_test.go
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Tue Nov 04 07:04:52 UTC 2025 - 8.9K bytes - Viewed (0) -
tests/create_test.go
package tests_test import ( "errors" "fmt" "regexp" "testing" "time" "github.com/jinzhu/now" "gorm.io/gorm" "gorm.io/gorm/clause" . "gorm.io/gorm/utils/tests" ) func TestCreate(t *testing.T) { u1 := *GetUser("create", Config{}) if results := DB.Create(&u1); results.Error != nil { t.Fatalf("errors happened when create: %v", results.Error) } else if results.RowsAffected != 1 {
Registered: Sun Dec 28 09:35:17 UTC 2025 - Last Modified: Mon Jul 21 09:55:20 UTC 2025 - 26.8K bytes - Viewed (0)