Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for SetupJoinTable (0.07 sec)

  1. 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)
  2. 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)
Back to top