Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 22 for Toy (0.11 sec)

  1. utils/tests/models.go

    	Active    bool
    }
    
    type Account struct {
    	gorm.Model
    	UserID sql.NullInt64
    	Number string
    }
    
    type Pet struct {
    	gorm.Model
    	UserID *uint
    	Name   string
    	Toy    Toy `gorm:"polymorphic:Owner;"`
    }
    
    type Toy struct {
    	gorm.Model
    	Name      string
    	OwnerID   string
    	OwnerType string
    }
    
    type Tools struct {
    	gorm.Model
    	Name     string
    	CustomID string
    	Type     string
    }
    
    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)
  2. tests/associations_has_many_test.go

    	toys := []Toy{{Name: "toy-has-many-append-1-1"}, {Name: "toy-has-many-append-1-1"}}
    
    	if err := DB.Model(&user2).Association("Toys").Append(&toys); err != nil {
    		t.Fatalf("Error happened when append toy, got %v", err)
    	}
    
    	for _, toy := range toys {
    		toy := toy
    		if toy.ID == 0 {
    			t.Fatalf("Toy's ID should be created")
    		}
    
    		user.Toys = append(user.Toys, toy)
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 15.6K bytes
    - Viewed (0)
  3. schema/relationship_test.go

    				"Toy": {
    					Name:        "Toy",
    					Type:        schema.HasOne,
    					Schema:      "User",
    					FieldSchema: "Toy",
    					Polymorphic: Polymorphic{ID: "OwnerID", Type: "OwnerType", Value: "users"},
    					References: []Reference{
    						{ForeignKey: "OwnerType", ForeignSchema: "Toy", PrimaryValue: "users"},
    						{ForeignKey: "OwnerType", ForeignSchema: "Toy", PrimaryValue: "users"},
    					},
    				},
    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)
  4. tests/helper_test.go

    	AssertObjEqual(t, pet, expect, "ID", "CreatedAt", "UpdatedAt", "DeletedAt", "UserID", "Name")
    
    	AssertObjEqual(t, pet.Toy, expect.Toy, "ID", "CreatedAt", "UpdatedAt", "DeletedAt", "Name", "OwnerID", "OwnerType")
    
    	if expect.Toy.Name != "" && expect.Toy.OwnerType != "pets" {
    		t.Errorf("toys's OwnerType, expect: %v, got %v", "pets", expect.Toy.OwnerType)
    	}
    }
    
    func CheckUserUnscoped(t *testing.T, user User, expect User) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 8K bytes
    - Viewed (0)
  5. tests/create_test.go

    		pets := []Pet{{
    			Name: "PolymorphicHasOne-Slice-1",
    			Toy:  Toy{Name: "Toy-PolymorphicHasOne-Slice-1"},
    		}, {
    			Name: "PolymorphicHasOne-Slice-2",
    			Toy:  Toy{Name: "Toy-PolymorphicHasOne-Slice-2"},
    		}, {
    			Name: "PolymorphicHasOne-Slice-3",
    			Toy:  Toy{Name: "Toy-PolymorphicHasOne-Slice-3"},
    		}}
    
    		if err := DB.Create(&pets).Error; err != nil {
    			t.Fatalf("errors happened when create: %v", err)
    		}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 26.4K bytes
    - Viewed (0)
  6. tests/preload_test.go

    	user := *GetUser("nested_preload", Config{Pets: 1})
    	pet := user.Pets[0]
    	pet.Toy = Toy{Name: "toy_nested_preload_" + strconv.Itoa(1)}
    	pet.Toy = Toy{Name: "toy_nested_preload_" + strconv.Itoa(2)}
    
    	if err := DB.Create(&user).Error; err != nil {
    		t.Fatalf("errors happened when create: %v", err)
    	}
    
    	var user2 User
    	DB.Preload("Pets.Toy").Find(&user2, "id = ?", user.ID)
    	CheckUser(t, user2, user)
    
    	DB.Delete(&pet)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 14.9K bytes
    - Viewed (0)
  7. schema/relationship.go

    		}
    	}
    }
    
    // User has many Toys, its `Polymorphic` is `Owner`, Pet has one Toy, its `Polymorphic` is `Owner`
    //
    //	type User struct {
    //	  Toys []Toy `gorm:"polymorphic:Owner;"`
    //	}
    //	type Pet struct {
    //	  Toy Toy `gorm:"polymorphic:Owner;"`
    //	}
    //	type Toy struct {
    //	  OwnerID   int
    //	  OwnerType string
    //	}
    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)
  8. helm/minio/README.md

    The command deploys MinIO on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.
    
    ### Installing the Chart (toy-setup)
    
    Minimal toy setup for testing purposes can be deployed using:
    
    ```bash
    Plain Text
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Wed Jan 24 07:27:57 GMT 2024
    - 10.9K bytes
    - Viewed (0)
  9. schema/schema_test.go

    		},
    		{
    			Name: "Toys", Type: schema.HasMany, Schema: "User", FieldSchema: "Toy",
    			Polymorphic: Polymorphic{ID: "OwnerID", Type: "OwnerType", Value: "users"},
    			References:  []Reference{{"ID", "User", "OwnerID", "Toy", "", true}, {"", "", "OwnerType", "Toy", "users", false}},
    		},
    		{
    			Name: "Company", Type: schema.BelongsTo, Schema: "User", FieldSchema: "Company",
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 12.9K bytes
    - Viewed (0)
  10. tests/tests_test.go

    	} else if debug == "false" {
    		db.Logger = db.Logger.LogMode(logger.Silent)
    	}
    
    	return
    }
    
    func RunMigrations() {
    	var err error
    	allModels := []interface{}{&User{}, &Account{}, &Pet{}, &Company{}, &Toy{}, &Language{}, &Coupon{}, &CouponProduct{}, &Order{}, &Parent{}, &Child{}, &Tools{}}
    	rand.Seed(time.Now().UnixNano())
    	rand.Shuffle(len(allModels), func(i, j int) { allModels[i], allModels[j] = allModels[j], allModels[i] })
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 3.3K bytes
    - Viewed (1)
Back to top