Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 33 for primaryKeys (0.1 sec)

  1. tests/migrate_test.go

    	if DB.Dialector.Name() != "postgres" {
    		return
    	}
    
    	type Event struct {
    		ID  uint `gorm:"primarykey"`
    		UID uint32
    	}
    
    	type Event1 struct {
    		ID  uint   `gorm:"primarykey"`
    		UID uint32 `gorm:"not null;autoIncrement"`
    	}
    
    	type Event2 struct {
    		ID  uint   `gorm:"primarykey"`
    		UID uint16 `gorm:"not null;autoIncrement"`
    	}
    
    	var err error
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Mar 18 11:24:16 UTC 2024
    - 56.2K bytes
    - Viewed (0)
  2. callbacks/query.go

    							for idx, ref := range relation.References {
    								if ref.OwnPrimaryKey {
    									exprs[idx] = clause.Eq{
    										Column: clause.Column{Table: parentTableName, Name: ref.PrimaryKey.DBName},
    										Value:  clause.Column{Table: tableAliasName, Name: ref.ForeignKey.DBName},
    									}
    								} else {
    									if ref.PrimaryValue == "" {
    										exprs[idx] = clause.Eq{
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Aug 22 11:03:42 UTC 2024
    - 10.1K bytes
    - Viewed (0)
  3. schema/field_test.go

    	if err != nil {
    		t.Fatalf("Failed to parse user with permission, got error %v", err)
    	}
    
    	fields := []*schema.Field{
    		{Name: "ID", DBName: "id", BindNames: []string{"ID"}, DataType: schema.Uint, PrimaryKey: true, Size: 64, Creatable: true, Updatable: true, Readable: true, HasDefaultValue: true, AutoIncrement: true},
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Sat Feb 19 09:02:53 UTC 2022
    - 12.7K bytes
    - Viewed (0)
  4. tests/multi_primary_keys_test.go

    		t.Fatalf("EN Blog's tags should be cleared")
    	}
    }
    
    func TestCompositePrimaryKeysAssociations(t *testing.T) {
    	type Label struct {
    		BookID *uint  `gorm:"primarykey"`
    		Name   string `gorm:"primarykey"`
    		Value  string
    	}
    
    	type Book struct {
    		ID     int
    		Name   string
    		Labels []Label
    	}
    
    	DB.Migrator().DropTable(&Label{}, &Book{})
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Jan 06 07:02:53 UTC 2022
    - 12.8K bytes
    - Viewed (0)
  5. callbacks/delete.go

    					tx             = db.Session(&gorm.Session{NewDB: true}).Model(modelValue).Table(table)
    				)
    
    				for _, ref := range rel.References {
    					if ref.OwnPrimaryKey {
    						foreignFields = append(foreignFields, ref.PrimaryKey)
    						relForeignKeys = append(relForeignKeys, ref.ForeignKey.DBName)
    					} else if ref.PrimaryValue != "" {
    						queryConds = append(queryConds, clause.Eq{
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Fri Feb 25 02:48:23 UTC 2022
    - 5.6K bytes
    - Viewed (0)
  6. clause/expression_test.go

    	}, {
    		SQL:    "?",
    		Vars:   []interface{}{clause.Column{Table: "table", Name: "col", Raw: true}},
    		Result: "table.col",
    	}, {
    		SQL:    "?",
    		Vars:   []interface{}{clause.Column{Table: "table", Name: clause.PrimaryKey, Raw: true}},
    		Result: "table.id",
    	}, {
    		SQL:    "?",
    		Vars:   []interface{}{clause.Column{Table: "table", Name: "col", Alias: "alias"}},
    		Result: "`table`.`col` AS `alias`",
    	}, {
    		SQL:    "?",
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Aug 10 05:34:33 UTC 2023
    - 8.4K bytes
    - Viewed (0)
  7. callbacks/update.go

    		case reflect.Struct:
    			set = make([]clause.Assignment, 0, len(stmt.Schema.FieldsByDBName))
    			for _, dbName := range stmt.Schema.DBNames {
    				if field := updatingSchema.LookUpField(dbName); field != nil {
    					if !field.PrimaryKey || !updatingValue.CanAddr() || stmt.Dest != stmt.Model {
    						if v, ok := selectColumns[field.DBName]; (ok && v) || (!ok && (!restricted || (!stmt.SkipHooks && field.AutoUpdateTime > 0))) {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Mar 18 05:44:55 UTC 2024
    - 9.4K bytes
    - Viewed (0)
  8. callbacks/create.go

    				for _, column := range values.Columns {
    					if field := stmt.Schema.LookUpField(column.Name); field != nil {
    						if v, ok := selectColumns[field.DBName]; (ok && v) || (!ok && !restricted) {
    							if !field.PrimaryKey && (!field.HasDefaultValue || field.DefaultValueInterface != nil ||
    								strings.EqualFold(field.DefaultValue, "NULL")) && field.AutoCreateTime == 0 {
    								if field.AutoUpdateTime > 0 {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Apr 08 03:29:55 UTC 2024
    - 12.5K bytes
    - Viewed (0)
  9. tests/create_test.go

    	}
    }
    
    func TestCreateWithAutoIncrementCompositeKey(t *testing.T) {
    	type CompositeKeyProduct struct {
    		ProductID    int `gorm:"primaryKey;autoIncrement:true;"` // primary key
    		LanguageCode int `gorm:"primaryKey;"`                    // primary key
    		Code         string
    		Name         string
    	}
    
    	if err := DB.Migrator().DropTable(&CompositeKeyProduct{}); err != nil {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Tue Mar 19 03:50:28 UTC 2024
    - 26.4K bytes
    - Viewed (0)
  10. tests/preload_test.go

    	if err != nil {
    		t.Errorf("failed to find value, got err: %v", err)
    	}
    	AssertEqual(t, find1, value)
    }
    
    func TestEmbedPreload(t *testing.T) {
    	type Country struct {
    		ID   int `gorm:"primaryKey"`
    		Name string
    	}
    	type EmbeddedAddress struct {
    		ID        int
    		Name      string
    		CountryID *int
    		Country   *Country
    	}
    	type NestedAddress struct {
    		EmbeddedAddress
    	}
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Wed Jun 12 10:00:47 UTC 2024
    - 15.9K bytes
    - Viewed (0)
Back to top