Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for Tag (0.14 sec)

  1. 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;"`
    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)
  2. tests/embedded_struct_test.go

    		Name string
    	}
    
    	DB.Migrator().DropTable(&EmbeddedTag{})
    	err := DB.Migrator().AutoMigrate(&EmbeddedTag{})
    	AssertEqual(t, err, nil)
    
    	t1 := EmbeddedTag{Name: "embedded_tag"}
    	err = DB.Save(&t1).Error
    	AssertEqual(t, err, nil)
    	if t1.Tag1.Id == 0 {
    		t.Errorf("embedded struct's primary field should be rewrited")
    	}
    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)
  3. schema/schema_helper_test.go

    	t.Run("CheckField/"+f.Name, func(t *testing.T) {
    		if fc != nil {
    			fc(f)
    		}
    
    		if f.TagSettings == nil {
    			if f.Tag != "" {
    				f.TagSettings = schema.ParseTagSetting(f.Tag.Get("gorm"), ";")
    			} else {
    				f.TagSettings = map[string]string{}
    			}
    		}
    
    		parsedField, ok := s.FieldsByDBName[f.DBName]
    		if !ok {
    			parsedField, ok = s.FieldsByName[f.Name]
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  4. migrator/migrator.go

    	// By default, ColumnType's Unique is not affected by UniqueIndex, so we don't care about UniqueIndex.
    	return m.RunWithValue(value, func(stmt *gorm.Statement) error {
    		// We're currently only receiving boolean values on `Unique` tag,
    		// so the UniqueConstraint name is fixed
    		constraint := m.DB.NamingStrategy.UniqueName(stmt.Table, field.DBName)
    		if unique && !field.Unique {
    			return m.DB.Migrator().DropConstraint(value, constraint)
    		}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  5. schema/index.go

    	for _, value := range strings.Split(field.Tag.Get("gorm"), ";") {
    		if value != "" {
    			v := strings.Split(value, ":")
    			k := strings.TrimSpace(strings.ToUpper(v[0]))
    			if k == "INDEX" || k == "UNIQUEINDEX" {
    				var (
    					name       string
    					tag        = strings.Join(v[1:], ":")
    					idx        = strings.Index(tag, ",")
    					tagSetting = strings.Join(strings.Split(tag, ",")[1:], ",")
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 3.7K bytes
    - Viewed (0)
  6. schema/utils.go

    		}
    	}
    	return
    }
    
    func removeSettingFromTag(tag reflect.StructTag, names ...string) reflect.StructTag {
    	for _, name := range names {
    		tag = reflect.StructTag(regexp.MustCompile(`(?i)(gorm:.*?)(`+name+`(:.*?)?)(;|("))`).ReplaceAllString(string(tag), "${1}${5}"))
    	}
    	return tag
    }
    
    func appendSettingFromTag(tag reflect.StructTag, value string) reflect.StructTag {
    	t := tag.Get("gorm")
    	if strings.Contains(t, value) {
    		return tag
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Aug 19 13:35:14 GMT 2023
    - 5.5K bytes
    - Viewed (0)
  7. tests/multi_primary_keys_test.go

    	Locale     string `gorm:"primary_key"`
    	Subject    string
    	Body       string
    	Tags       []Tag `gorm:"many2many:blog_tags;"`
    	SharedTags []Tag `gorm:"many2many:shared_blog_tags;ForeignKey:id;References:id"`
    	LocaleTags []Tag `gorm:"many2many:locale_blog_tags;ForeignKey:id,locale;References:id"`
    }
    
    type Tag struct {
    	ID     uint   `gorm:"primary_key"`
    	Locale string `gorm:"primary_key"`
    	Value  string
    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)
  8. schema/field_test.go

    		{Name: "Name", DBName: "", BindNames: []string{"Name"}, DataType: "", Tag: `gorm:"-"`, Creatable: false, Updatable: false, Readable: false},
    		{Name: "Name2", DBName: "name2", BindNames: []string{"Name2"}, DataType: schema.String, Tag: `gorm:"->"`, Creatable: false, Updatable: false, Readable: true},
    		{Name: "Name3", DBName: "name3", BindNames: []string{"Name3"}, DataType: schema.String, Tag: `gorm:"<-"`, Creatable: true, Updatable: true, Readable: true},
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 19 09:02:53 GMT 2022
    - 12.7K bytes
    - Viewed (0)
  9. schema/schema_test.go

    				{
    					Name: "UserID", DBName: "user_id", BindNames: []string{"UserID"}, DataType: schema.Uint,
    					Tag: `gorm:"primarykey"`, Creatable: true, Updatable: true, Readable: true, PrimaryKey: true, Size: 64,
    				},
    				{
    					Name: "LanguageCode", DBName: "language_code", BindNames: []string{"LanguageCode"}, DataType: schema.String,
    					Tag: `gorm:"primarykey"`, Creatable: true, Updatable: true, Readable: true, PrimaryKey: true,
    				},
    			}},
    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. schema/relationship.go

    				Type:    relField.StructField.Type,
    				Tag: removeSettingFromTag(appendSettingFromTag(relField.StructField.Tag, "primaryKey"),
    					"column", "autoincrement", "index", "unique", "uniqueindex"),
    			})
    		}
    	}
    
    	joinTableFields = append(joinTableFields, reflect.StructField{
    		Name: strings.Title(schema.Name) + field.Name,
    		Type: schema.ModelType,
    		Tag:  `gorm:"-"`,
    	})
    
    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)
Back to top