- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 10 for primary_key (0.05 sec)
-
schema/relationship_test.go
}, }) } func TestMany2ManyWithMultiPrimaryKeys(t *testing.T) { type Tag struct { ID uint `gorm:"primary_key"` Locale string `gorm:"primary_key"` Value string } type Blog struct { ID uint `gorm:"primary_key"` Locale string `gorm:"primary_key"` Subject string Body string Tags []Tag `gorm:"many2many:blog_tags;"`
Registered: Sun Sep 07 09:35:13 UTC 2025 - Last Modified: Mon Aug 18 11:44:52 UTC 2025 - 26.5K bytes - Viewed (0) -
schema/field.go
} if prefix, ok := field.TagSettings["EMBEDDEDPREFIX"]; ok && ef.DBName != "" { ef.DBName = prefix + ef.DBName } if ef.PrimaryKey { if !utils.CheckTruth(ef.TagSettings["PRIMARYKEY"], ef.TagSettings["PRIMARY_KEY"]) { ef.PrimaryKey = false if val, ok := ef.TagSettings["AUTOINCREMENT"]; !ok || !utils.CheckTruth(val) { ef.AutoIncrement = false }
Registered: Sun Sep 07 09:35:13 UTC 2025 - Last Modified: Wed Aug 20 04:51:17 UTC 2025 - 32K bytes - Viewed (0) -
tests/migrate_test.go
return } type UniqueTest struct { ID string `gorm:"primary_key"` Name string `gorm:"unique"` } type UniqueTest2 struct { ID string `gorm:"primary_key"` Name string `gorm:"unique;default:NULL"` } type UniqueTest3 struct { ID string `gorm:"primary_key"` Name string `gorm:"unique;default:''"` } type UniqueTest4 struct {
Registered: Sun Sep 07 09:35:13 UTC 2025 - Last Modified: Wed Aug 20 04:51:17 UTC 2025 - 65.2K bytes - Viewed (0) -
docs/en/docs/tutorial/sql-databases.md
There are a few differences: * `table=True` tells SQLModel that this is a *table model*, it should represent a **table** in the SQL database, it's not just a *data model* (as would be any other regular Pydantic class). * `Field(primary_key=True)` tells SQLModel that the `id` is the **primary key** in the SQL database (you can learn more about SQL primary keys in the SQLModel docs).
Registered: Sun Sep 07 07:19:17 UTC 2025 - Last Modified: Sun Aug 31 09:15:41 UTC 2025 - 15.4K bytes - Viewed (0) -
schema/relationship.go
} else { primarySchemaName := primarySchema.Name if primarySchemaName == "" { primarySchemaName = relation.FieldSchema.Name } if len(relation.primaryKeys) > 0 { for _, primaryKey := range relation.primaryKeys { if f := primarySchema.LookUpField(primaryKey); f != nil { primaryFields = append(primaryFields, f) } } } else { primaryFields = primarySchema.PrimaryFields }
Registered: Sun Sep 07 09:35:13 UTC 2025 - Last Modified: Mon Aug 18 11:44:52 UTC 2025 - 23.1K bytes - Viewed (1) -
schema/schema_helper_test.go
for _, rf := range r.References { var primaryKey, primaryKeySchema string if rf.PrimaryKey != nil { primaryKey, primaryKeySchema = rf.PrimaryKey.Name, rf.PrimaryKey.Schema.Name } refs = append(refs, fmt.Sprintf( "{PrimaryKey: %v PrimaryKeySchame: %v ForeignKey: %v ForeignKeySchema: %v PrimaryValue: %v OwnPrimaryKey: %v}",
Registered: Sun Sep 07 09:35:13 UTC 2025 - Last Modified: Thu Aug 28 02:57:17 UTC 2025 - 7.5K bytes - Viewed (0) -
schema/schema_test.go
// check fields fields := []schema.Field{ {Name: "ID", DBName: "id", BindNames: []string{"Model", "ID"}, DataType: schema.Uint, PrimaryKey: true, Tag: `gorm:"primarykey"`, TagSettings: map[string]string{"PRIMARYKEY": "PRIMARYKEY"}, Size: 64, HasDefaultValue: true, AutoIncrement: true}, {Name: "CreatedAt", DBName: "created_at", BindNames: []string{"Model", "CreatedAt"}, DataType: schema.Time},
Registered: Sun Sep 07 09:35:13 UTC 2025 - Last Modified: Thu Aug 28 02:57:17 UTC 2025 - 13.3K bytes - Viewed (0) -
schema/schema.go
schema.FieldsByBindName[bindName] = field if v != nil && v.PrimaryKey { // remove the existing primary key field for idx, f := range schema.PrimaryFields { if f.DBName == v.DBName { schema.PrimaryFields = append(schema.PrimaryFields[0:idx], schema.PrimaryFields[idx+1:]...) } } } if field.PrimaryKey { schema.PrimaryFields = append(schema.PrimaryFields, field) }
Registered: Sun Sep 07 09:35:13 UTC 2025 - Last Modified: Tue Aug 19 06:35:49 UTC 2025 - 12.9K bytes - Viewed (0) -
finisher_api.go
func (db *DB) First(dest interface{}, conds ...interface{}) (tx *DB) { tx = db.Limit(1).Order(clause.OrderByColumn{ Column: clause.Column{Table: clause.CurrentTable, Name: clause.PrimaryKey}, }) if len(conds) > 0 { if exprs := tx.Statement.BuildCondition(conds[0], conds[1:]...); len(exprs) > 0 { tx.Statement.AddClause(clause.Where{Exprs: exprs}) } }
Registered: Sun Sep 07 09:35:13 UTC 2025 - Last Modified: Tue Aug 26 06:24:29 UTC 2025 - 22.9K bytes - Viewed (0) -
statement.go
conds = append(conds, clause.IN{Column: clause.Column{Table: curTable, Name: clause.PrimaryKey}, Values: values}) return []clause.Expression{clause.And(conds...)} } return nil } } conds = append(conds, clause.IN{Column: clause.Column{Table: curTable, Name: clause.PrimaryKey}, Values: args}) } } } if len(conds) > 0 {
Registered: Sun Sep 07 09:35:13 UTC 2025 - Last Modified: Thu Sep 04 13:13:16 UTC 2025 - 20.8K bytes - Viewed (0)