Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 42 for _key (0.13 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/postgres_test.go

    		t.Fatalf("failed to found column log_id")
    	}
    }
    
    type Post struct {
    	ID         uuid.UUID `gorm:"primary_key;type:uuid;default:uuid_generate_v4();"`
    	Title      string
    	Categories []*Category `gorm:"Many2Many:post_categories"`
    }
    
    type Category struct {
    	ID    uuid.UUID `gorm:"primary_key;type:uuid;default:uuid_generate_v4();"`
    	Title string
    	Posts []*Post `gorm:"Many2Many:post_categories"`
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Oct 08 09:16:32 GMT 2022
    - 6.4K bytes
    - Viewed (3)
  3. tests/preload_suits_test.go

    	}
    
    	type (
    		Level1 struct {
    			ID           uint   `gorm:"primary_key;"`
    			LanguageCode string `gorm:"primary_key"`
    			Value        string
    		}
    		Level2 struct {
    			ID           uint   `gorm:"primary_key;"`
    			LanguageCode string `gorm:"primary_key"`
    			Value        string
    			Level1s      []Level1 `gorm:"many2many:levels;"`
    		}
    	)
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Mar 18 05:38:46 GMT 2022
    - 30.3K bytes
    - Viewed (0)
  4. tests/create_test.go

    	}
    
    	jt := JoinTable{UserID: 1, FriendID: 2}
    	err := DB.Create(&jt).Error
    	if err != nil {
    		t.Errorf("No error should happen when create a record without a GORM primary key. But in the database this primary key exists and is the union of 2 or more fields\n But got: %s", err)
    	}
    }
    
    func TestSelectWithCreate(t *testing.T) {
    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)
  5. tests/customize_field_test.go

    import (
    	"testing"
    	"time"
    
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestCustomizeColumn(t *testing.T) {
    	type CustomizeColumn struct {
    		ID   int64      `gorm:"column:mapped_id; primary_key:yes"`
    		Name string     `gorm:"column:mapped_name"`
    		Date *time.Time `gorm:"column:mapped_time"`
    	}
    
    	DB.Migrator().DropTable(&CustomizeColumn{})
    	DB.AutoMigrate(&CustomizeColumn{})
    
    	expected := "foo"
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Sep 11 09:33:31 GMT 2020
    - 6.9K bytes
    - Viewed (0)
  6. tests/migrate_test.go

    		return
    	}
    
    	type UniqueTest struct {
    		ID   string `gorm:"primary_key"`
    		Name string `gorm:"unique"`
    	}
    
    	type UniqueTest2 struct {
    		ID   string `gorm:"primary_key"`
    		Name string `gorm:"unique;default:NULL"`
    	}
    
    	type UniqueTest3 struct {
    		ID   string `gorm:"primary_key"`
    		Name string `gorm:"unique;default:''"`
    	}
    
    	type UniqueTest4 struct {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  7. clause/set.go

    }
    
    func Assignments(values map[string]interface{}) Set {
    	keys := make([]string, 0, len(values))
    	for key := range values {
    		keys = append(keys, key)
    	}
    	sort.Strings(keys)
    
    	assignments := make([]Assignment, len(keys))
    	for idx, key := range keys {
    		assignments[idx] = Assignment{Column: Column{Name: key}, Value: values[key]}
    	}
    	return assignments
    }
    
    func AssignmentColumns(values []string) Set {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Nov 29 03:02:44 GMT 2021
    - 1.4K bytes
    - Viewed (0)
  8. migrator/index.go

    func (idx Index) Name() string {
    	return idx.NameValue
    }
    
    // Columns return the columns of the index
    func (idx Index) Columns() []string {
    	return idx.ColumnList
    }
    
    // PrimaryKey returns the index is primary key or not.
    func (idx Index) PrimaryKey() (isPrimaryKey bool, ok bool) {
    	return idx.PrimaryKeyValue.Bool, idx.PrimaryKeyValue.Valid
    }
    
    // Unique returns whether the index is unique or not.
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Apr 11 02:32:46 GMT 2023
    - 1023 bytes
    - Viewed (0)
  9. migrator/migrator.go

    					values = append(values, clause.Column{Name: dbName}, m.DB.Migrator().FullDataTypeOf(field))
    					createTableSQL += ","
    				}
    			}
    
    			if !hasPrimaryKeyInDataType && len(stmt.Schema.PrimaryFields) > 0 {
    				createTableSQL += "PRIMARY KEY ?,"
    				primaryKeys := make([]interface{}, 0, len(stmt.Schema.PrimaryFields))
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  10. schema/schema_helper_test.go

    					t.Errorf("schema %v prioritized primary field should be %v, but got %v", s, field, s.PrioritizedPrimaryField.Name)
    				}
    			}
    
    			if !found {
    				t.Errorf("schema %v failed to found primary key: %v", s, field)
    			}
    		}
    	})
    }
    
    func checkSchemaField(t *testing.T, s *schema.Schema, f *schema.Field, fc func(*schema.Field)) {
    	t.Run("CheckField/"+f.Name, func(t *testing.T) {
    		if fc != nil {
    			fc(f)
    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)
Back to top