- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 10 for constraint (0.25 sec)
-
schema/constraint.go
Name string Constraint string // length(phone) >= 10 *Field } func (chk *CheckConstraint) GetName() string { return chk.Name } func (chk *CheckConstraint) Build() (sql string, vars []interface{}) { return "CONSTRAINT ? CHECK (?)", []interface{}{clause.Column{Name: chk.Name}, clause.Expr{SQL: chk.Constraint}} } // ParseCheckConstraints parse schema check constraints
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Mon Mar 18 07:33:54 GMT 2024 - 1.9K bytes - Viewed (0) -
schema/constraint_test.go
results := map[string]schema.CheckConstraint{ "name_checker": { Name: "name_checker", Constraint: "name <> 'jinzhu'", }, "chk_user_checks_name2": { Name: "chk_user_checks_name2", Constraint: "name <> 'jinzhu'", }, "chk_user_checks_name3": { Name: "chk_user_checks_name3", Constraint: "name <> 'jinzhu'", }, } checks := user.ParseCheckConstraints()
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Sun Feb 04 07:49:19 GMT 2024 - 2.2K bytes - Viewed (0) -
migrator/migrator.go
currentDatabase := m.DB.Migrator().CurrentDatabase() constraint, table := m.GuessConstraintInterfaceAndTable(stmt, name) if constraint != nil { name = constraint.GetName() } return m.DB.Raw( "SELECT count(*) FROM INFORMATION_SCHEMA.table_constraints WHERE constraint_schema = ? AND table_name = ? AND constraint_name = ?", currentDatabase, table, name, ).Row().Scan(&count) })
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Apr 26 07:15:49 GMT 2024 - 29K bytes - Viewed (0) -
schema/relationship_test.go
} expectedConstraintName := "fk_my_schema_a_very_very_very_very_very_very_very_very_l4db13eec" constraint := s.Relationships.Relations["Author"].ParseConstraint() if constraint.Name != expectedConstraintName { t.Fatalf( "expected constraint name %s, got %s", expectedConstraintName, constraint.Name, ) }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Mon Apr 15 03:20:20 GMT 2024 - 25.5K bytes - Viewed (0) -
errors.go
// ErrDuplicatedKey occurs when there is a unique key constraint violation ErrDuplicatedKey = errors.New("duplicated key not allowed") // ErrForeignKeyViolated occurs when there is a foreign key constraint violation ErrForeignKeyViolated = errors.New("violates foreign key constraint") // ErrCheckConstraintViolated occurs when there is a check constraint violation ErrCheckConstraintViolated = errors.New("violates check constraint")
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Apr 26 02:53:17 GMT 2024 - 2.5K bytes - Viewed (0) -
tests/table_test.go
t.Fatalf("failed to parse user unique, got error %v", err) } constraints := user.ParseUniqueConstraints() if len(constraints) != 1 { t.Fatalf("failed to find unique constraint, got %v", constraints) } for key := range constraints { if len(key) != 63 { t.Errorf("failed to find unique constraint, got %v", constraints) } } }) t.Run("naming strategy", func(t *testing.T) {
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Sat Mar 09 09:31:28 GMT 2024 - 10.6K bytes - Viewed (0) -
utils/tests/models.go
type Language struct { Code string `gorm:"primarykey"` Name string } type Coupon struct { ID int `gorm:"primarykey; size:255"` AppliesToProduct []*CouponProduct `gorm:"foreignKey:CouponId;constraint:OnDelete:CASCADE"` AmountOff uint32 `gorm:"column:amount_off"` PercentOff float32 `gorm:"column:percent_off"` } type CouponProduct struct {
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Dec 15 08:36:08 GMT 2023 - 2.1K bytes - Viewed (0) -
schema/interfaces.go
package schema import ( "gorm.io/gorm/clause" ) // ConstraintInterface database constraint interface type ConstraintInterface interface { GetName() string Build() (sql string, vars []interface{}) } // GormDataTypeInterface gorm data type interface type GormDataTypeInterface interface { GormDataType() string } // FieldNewValuePool field new scan value pool type FieldNewValuePool interface { Get() interface{}
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Sun Feb 04 07:49:19 GMT 2024 - 980 bytes - Viewed (0) -
tests/migrate_test.go
t.Fatalf("failed to drop constraint %v, got error %v", name, err) } if DB.Migrator().HasConstraint(&User{}, name) { t.Fatalf("constraint %v should been deleted", name) } if err := DB.Migrator().CreateConstraint(&User{}, name); err != nil { t.Fatalf("failed to create constraint %v, got error %v", name, err) }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Mon Mar 18 11:24:16 GMT 2024 - 56.2K bytes - Viewed (0) -
schema/relationship.go
sql = "CONSTRAINT ? FOREIGN KEY ? REFERENCES ??" if constraint.OnDelete != "" { sql += " ON DELETE " + constraint.OnDelete } if constraint.OnUpdate != "" { sql += " ON UPDATE " + constraint.OnUpdate } foreignKeys := make([]interface{}, 0, len(constraint.ForeignKeys)) for _, field := range constraint.ForeignKeys { foreignKeys = append(foreignKeys, clause.Column{Name: field.DBName})
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Mon Apr 15 03:20:20 GMT 2024 - 22.4K bytes - Viewed (0)