- Sort Score
- Result 10 results
- Languages All
Results 1 - 7 of 7 for has_many (0.07 sec)
-
schema/relationship.go
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: schema.Relationships.HasMany = append(schema.Relationships.HasMany, relation) case BelongsTo:
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 03:46:59 UTC 2024 - 22.7K bytes - Viewed (0) -
tests/associations_has_many_test.go
} AssertAssociationCount(t, user2, "Team", 0, "after clear") } func TestHasManyAssociationForSlice(t *testing.T) { users := []User{ *GetUser("slice-hasmany-1", Config{Pets: 2}), *GetUser("slice-hasmany-2", Config{Pets: 0}), *GetUser("slice-hasmany-3", Config{Pets: 4}), } DB.Create(&users) // Count AssertAssociationCount(t, users, "Pets", 6, "") // Find var pets []Pet
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 16K bytes - Viewed (0) -
schema/schema_test.go
References: []Reference{{"ID", "User", "UserID", "Account", "", true}}, }, { Name: "Pets", Type: schema.HasMany, Schema: "User", FieldSchema: "Pet", References: []Reference{{"ID", "User", "UserID", "Pet", "", true}}, }, { Name: "Toys", Type: schema.HasMany, Schema: "User", FieldSchema: "Toy", Polymorphic: Polymorphic{ID: "OwnerID", Type: "OwnerType", Value: "users"},
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/preload.go
} } fieldValues := make([]interface{}, len(relForeignFields)) // clean up old values before preloading switch reflectValue.Kind() { case reflect.Struct: switch rel.Type { case schema.HasMany, schema.Many2Many: tx.AddError(rel.Field.Set(tx.Statement.Context, reflectValue, reflect.MakeSlice(rel.Field.IndirectFieldType, 0, 10).Interface())) default:
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:52:33 UTC 2024 - 11.6K bytes - Viewed (0) -
association.go
if association.Unscope && oldBelongsToExpr != nil { association.Error = association.DB.Model(nil).Where(oldBelongsToExpr).Delete(reflect.New(rel.FieldSchema.ModelType).Interface()).Error } case schema.HasOne, schema.HasMany: var ( primaryFields []*schema.Field foreignKeys []string updateMap = map[string]interface{}{}
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 21.5K bytes - Viewed (0) -
internal/grid/manager.go
return ErrUnknownHandler } s := strings.Join(subroute, "/") if debugPrint { fmt.Println("RegisterSingleHandler: ", id.String(), "subroute:", s) } if len(subroute) == 0 { if m.handlers.hasAny(id) && !id.isTestHandler() { return fmt.Errorf("handler %v: %w", id.String(), ErrHandlerAlreadyExists) } m.handlers.single[id] = h return nil } subID := makeSubHandlerID(id, s)
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Mon Jul 29 18:10:04 UTC 2024 - 10.6K bytes - Viewed (0) -
internal/grid/handlers.go
func (h *handlers) init() { h.subSingle = make(map[subHandlerID]SingleHandlerFn) h.subStateless = make(map[subHandlerID]*StatelessHandler) h.subStreams = make(map[subHandlerID]*StreamHandler) } func (h *handlers) hasAny(id HandlerID) bool { if !id.valid() { return false } return h.single[id] != nil || h.stateless[id] != nil || h.streams[id] != nil } func (h *handlers) hasSubhandler(id subHandlerID) bool {
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Mon Sep 09 16:58:30 UTC 2024 - 27.7K bytes - Viewed (0)