- Sort Score
- Result 10 results
- Languages All
Results 1 - 3 of 3 for SetupJoinTable (0.08 sec)
-
tests/joins_table_test.go
PersonID int AddressID int CreatedAt time.Time DeletedAt gorm.DeletedAt } func TestOverrideJoinTable(t *testing.T) { DB.Migrator().DropTable(&Person{}, &Address{}, &PersonAddress{}) if err := DB.SetupJoinTable(&Person{}, "Addresses", &PersonAddress{}); err != nil { t.Fatalf("Failed to setup join table for person, got error %v", err) } if err := DB.AutoMigrate(&Person{}, &Address{}); err != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Sep 10 13:46:18 UTC 2020 - 3.5K bytes - Viewed (0) -
gorm.go
// Expr returns clause.Expr, which can be used to pass SQL expression as params func Expr(expr string, args ...interface{}) clause.Expr { return clause.Expr{SQL: expr, Vars: args} } // SetupJoinTable setup join table schema func (db *DB) SetupJoinTable(model interface{}, field string, joinTable interface{}) error { var ( tx = db.getInstance() stmt = tx.Statement
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Oct 09 11:29:48 UTC 2024 - 12.1K bytes - Viewed (0) -
tests/associations_test.go
Name string Organizations []Organization `gorm:"many2many:region_orgs;"` } type RegionOrg struct { RegionId uint OrganizationId uint Empty myType } if err := DB.SetupJoinTable(&Region{}, "Organizations", &RegionOrg{}); err != nil { t.Fatalf("Failed to set up join table, got error: %s", err) } if err := DB.Migrator().DropTable(&Organization{}, &Region{}); err != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Feb 08 08:29:09 UTC 2023 - 10.9K bytes - Viewed (0)