Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for ntag2 (0.12 sec)

  1. tests/embedded_struct_test.go

    		}
    	}
    }
    
    func TestEmbeddedTagSetting(t *testing.T) {
    	type Tag1 struct {
    		Id int64 `gorm:"autoIncrement"`
    	}
    	type Tag2 struct {
    		Id int64
    	}
    
    	type EmbeddedTag struct {
    		Tag1 Tag1 `gorm:"Embedded;"`
    		Tag2 Tag2 `gorm:"Embedded;EmbeddedPrefix:t2_"`
    		Name string
    	}
    
    	DB.Migrator().DropTable(&EmbeddedTag{})
    	err := DB.Migrator().AutoMigrate(&EmbeddedTag{})
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Oct 26 03:58:13 GMT 2023
    - 7.3K bytes
    - Viewed (0)
  2. tests/multi_primary_keys_test.go

    			{Locale: "ZH", Value: "tag1"},
    			{Locale: "ZH", Value: "tag2"},
    		},
    	}
    
    	DB.Save(&blog)
    	if !compareTags(blog.Tags, []string{"tag1", "tag2"}) {
    		t.Fatalf("Blog should has two tags")
    	}
    
    	// Append
    	tag3 := &Tag{Locale: "ZH", Value: "tag3"}
    	DB.Model(&blog).Association("Tags").Append([]*Tag{tag3})
    
    	if !compareTags(blog.Tags, []string{"tag1", "tag2", "tag3"}) {
    		t.Fatalf("Blog should has three tags after Append")
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 12.8K bytes
    - Viewed (0)
Back to top