- Sort Score
- Result 10 results
- Languages All
Results 1 - 8 of 8 for uniqueIndex (0.16 sec)
-
tests/migrate_test.go
} if field.UniqueIndex != uniqueIndex { t.Fatalf("%v: %q column %q uniqueIndex should be %v but got %v", utils.FileWithLineNum(), stmt.Schema, fieldName, uniqueIndex, field.UniqueIndex) } } type ( // not unique UniqueStruct1 struct { Name string `gorm:"size:10"` }
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/index_test.go
FieldC string `gorm:"index:,unique"` // uniqueIndex FieldD string `gorm:"uniqueIndex;index"` // uniqueIndex and index FieldE1 string `gorm:"uniqueIndex:uniq_field_e1_e2"` // mul uniqueIndex FieldE2 string `gorm:"uniqueIndex:uniq_field_e1_e2"` FieldF1 string `gorm:"uniqueIndex:uniq_field_f1_f2;index"` // mul uniqueIndex and index FieldF2 string `gorm:"uniqueIndex:uniq_field_f1_f2;"`
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Sun Feb 04 07:49:19 GMT 2024 - 8K bytes - Viewed (0) -
schema/index.go
// ParseIndexes parse schema indexes func (schema *Schema) ParseIndexes() map[string]Index { indexes := map[string]Index{} for _, field := range schema.Fields { if field.TagSettings["INDEX"] != "" || field.TagSettings["UNIQUEINDEX"] != "" { fieldIndexes, err := parseFieldIndexes(field) if err != nil { schema.err = err break } for _, index := range fieldIndexes { idx := indexes[index.Name] idx.Name = index.Name
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Sun Feb 04 07:49:19 GMT 2024 - 3.7K bytes - Viewed (0) -
migrator/migrator.go
unique, ok := columnType.Unique() if !ok || field.PrimaryKey { return nil // skip primary key } // By default, ColumnType's Unique is not affected by UniqueIndex, so we don't care about UniqueIndex. return m.RunWithValue(value, func(stmt *gorm.Statement) error { // We're currently only receiving boolean values on `Unique` tag, // so the UniqueConstraint name is fixed
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/constraint_test.go
) } } } } func TestParseUniqueConstraints(t *testing.T) { type UserUnique struct { Name1 string `gorm:"unique"` Name2 string `gorm:"uniqueIndex"` } user, err := schema.Parse(&UserUnique{}, &sync.Map{}, schema.NamingStrategy{}) if err != nil { t.Fatalf("failed to parse user unique, got error %v", err) } constraints := user.ParseUniqueConstraints()
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) -
tests/associations_test.go
type AssociationEmptyUser struct { ID uint Name string Pets []AssociationEmptyPet } type AssociationEmptyPet struct { AssociationEmptyUserID *uint `gorm:"uniqueIndex:uniq_user_id_name"` Name string `gorm:"uniqueIndex:uniq_user_id_name;size:256"` } func TestAssociationEmptyPrimaryKey(t *testing.T) { if DB.Dialector.Name() != "mysql" { t.Skip() }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Wed Feb 08 08:29:09 GMT 2023 - 10.9K bytes - Viewed (0) -
schema/field.go
// In some db (e.g. MySQL), Unique and UniqueIndex are indistinguishable. // When a column has a (not Mul) UniqueIndex, Migrator always reports its gorm.ColumnType is Unique. // It causes field unnecessarily migration. // Therefore, we need to record the UniqueIndex on this column (exclude Mul UniqueIndex) for MigrateColumnUnique. UniqueIndex string } func (field *Field) BindName() string {
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Mon Apr 15 03:20:20 GMT 2024 - 32K bytes - Viewed (1) -
schema/relationship.go
PkgPath: ownField.StructField.PkgPath, Type: ownField.StructField.Type, Tag: removeSettingFromTag(appendSettingFromTag(ownField.StructField.Tag, "primaryKey"), "column", "autoincrement", "index", "unique", "uniqueindex"), }) } for idx, relField := range refForeignFields { joinFieldName := strings.Title(relation.FieldSchema.Name) + relField.Name if _, ok := ownFieldsMap[joinFieldName]; ok {
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)