- Sort Score
- Result 10 results
- Languages All
Results 1 - 9 of 9 for HasOne (0.06 sec)
-
schema/relationship_test.go
UserRefer uint } type User struct { gorm.Model Profile Profile `gorm:"ForeignKey:UserRefer"` } checkStructRelation(t, &User{}, Relation{ Name: "Profile", Type: schema.HasOne, Schema: "User", FieldSchema: "Profile", References: []Reference{{"ID", "User", "UserRefer", "Profile", "", true}}, }) } func TestHasOneOverrideReferences(t *testing.T) { type Profile struct { gorm.Model
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Apr 15 03:20:20 UTC 2024 - 25.5K bytes - Viewed (0) -
tests/associations_has_one_test.go
t.Errorf("account's number should not be saved") } } func TestHasOneAssociationForSlice(t *testing.T) { users := []User{ *GetUser("slice-hasone-1", Config{Account: true}), *GetUser("slice-hasone-2", Config{Account: false}), *GetUser("slice-hasone-3", Config{Account: true}), } DB.Create(&users) // Count AssertAssociationCount(t, users, "Account", 2, "") // Find
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 7.1K bytes - Viewed (0) -
schema/relationship.go
} switch field.IndirectFieldType.Kind() { case reflect.Struct: relation.Type = HasOne case reflect.Slice: relation.Type = HasMany } } if schema.err == nil { schema.setRelation(relation) switch relation.Type { case HasOne: schema.Relationships.HasOne = append(schema.Relationships.HasOne, relation) case HasMany:
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 03:46:59 UTC 2024 - 22.7K bytes - Viewed (0) -
association.go
} return association.Error } func (association *Association) Append(values ...interface{}) error { if association.Error == nil { switch association.Relationship.Type { case schema.HasOne, schema.BelongsTo: if len(values) > 0 { association.Error = association.Replace(values...) } default: association.saveAssociation( /*clear*/ false, values...) } } return association.Error
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 21.5K bytes - Viewed (0) -
schema/schema_test.go
f.Creatable = true f.Updatable = true f.Readable = true }) } // check relations relations := []Relation{ { Name: "Account", Type: schema.HasOne, Schema: "User", FieldSchema: "Account", References: []Reference{{"ID", "User", "UserID", "Account", "", true}}, }, { Name: "Pets", Type: schema.HasMany, Schema: "User", FieldSchema: "Pet",
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jun 20 12:19:31 UTC 2024 - 13.3K bytes - Viewed (0) -
callbacks/associations.go
if db.Error == nil && db.Statement.Schema != nil { selectColumns, restricted := db.Statement.SelectAndOmitColumns(create, !create) // Save Has One associations for _, rel := range db.Statement.Schema.Relationships.HasOne { if v, ok := selectColumns[rel.Name]; (ok && !v) || (!ok && restricted) { continue } switch db.Statement.ReflectValue.Kind() { case reflect.Slice, reflect.Array: var (
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Apr 11 03:06:13 UTC 2023 - 14.3K bytes - Viewed (0) -
migrator/migrator.go
if uni, ok := uniqueConstraints[name]; ok { return &uni, stmt.Table } getTable := func(rel *schema.Relationship) string { switch rel.Type { case schema.HasOne, schema.HasMany: return rel.FieldSchema.Table case schema.Many2Many: return rel.JoinTable.Table } return stmt.Table } for _, rel := range stmt.Schema.Relationships.Relations {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Apr 26 07:15:49 UTC 2024 - 29K bytes - Viewed (0) -
docs/pl/docs/features.md
* Walidacja **złożonych struktur**: * Wykorzystanie hierarchicznych modeli Pydantic, Pythonowego modułu `typing` zawierającego `List`, `Dict`, itp. * Walidatory umożliwiają jasne i łatwe definiowanie, sprawdzanie złożonych struktur danych oraz dokumentowanie ich jako JSON Schema. * Możesz mieć głęboko **zagnieżdżone obiekty JSON** i wszystkie je poddać walidacji i adnotować. * **Rozszerzalność**:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Aug 06 04:48:30 UTC 2024 - 10.9K bytes - Viewed (0) -
docs/pl/docs/help-fastapi.md
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Aug 06 04:48:30 UTC 2024 - 14.9K bytes - Viewed (0)