Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 33 for PrimaryKey (0.17 sec)

  1. migrator.go

    }
    
    // ColumnType column type interface
    type ColumnType interface {
    	Name() string
    	DatabaseTypeName() string                 // varchar
    	ColumnType() (columnType string, ok bool) // varchar(64)
    	PrimaryKey() (isPrimaryKey bool, ok bool)
    	AutoIncrement() (isAutoIncrement bool, ok bool)
    	Length() (length int64, ok bool)
    	DecimalSize() (precision int64, scale int64, ok bool)
    	Nullable() (nullable bool, ok bool)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  2. migrator/column_type.go

    func (ct ColumnType) ColumnType() (columnType string, ok bool) {
    	return ct.ColumnTypeValue.String, ct.ColumnTypeValue.Valid
    }
    
    // PrimaryKey returns the column is primary key or not.
    func (ct ColumnType) PrimaryKey() (isPrimaryKey bool, ok bool) {
    	return ct.PrimaryKeyValue.Bool, ct.PrimaryKeyValue.Valid
    }
    
    // AutoIncrement returns the column is auto increment or not.
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 24 01:31:58 GMT 2022
    - 3.3K bytes
    - Viewed (0)
  3. callbacks/preload.go

    				foreignFields = append(foreignFields, ref.PrimaryKey)
    			} else if ref.PrimaryValue != "" {
    				tx = tx.Where(clause.Eq{Column: ref.ForeignKey.DBName, Value: ref.PrimaryValue})
    			} else {
    				joinRelForeignFields = append(joinRelForeignFields, ref.ForeignKey)
    				relForeignKeys = append(relForeignKeys, ref.PrimaryKey.DBName)
    				relForeignFields = append(relForeignFields, ref.PrimaryKey)
    			}
    		}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  4. association.go

    				if ref.PrimaryValue == "" {
    					if ref.OwnPrimaryKey {
    						primaryFields = append(primaryFields, ref.PrimaryKey)
    						joinPrimaryKeys = append(joinPrimaryKeys, ref.ForeignKey.DBName)
    					} else {
    						relPrimaryFields = append(relPrimaryFields, ref.PrimaryKey)
    						joinRelPrimaryKeys = append(joinRelPrimaryKeys, ref.ForeignKey.DBName)
    					}
    				} else {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu May 04 11:30:45 GMT 2023
    - 21.2K bytes
    - Viewed (0)
  5. schema/schema.go

    				schema.FieldsByBindName[bindName] = field
    
    				if v != nil && v.PrimaryKey {
    					for idx, f := range schema.PrimaryFields {
    						if f == v {
    							schema.PrimaryFields = append(schema.PrimaryFields[0:idx], schema.PrimaryFields[idx+1:]...)
    						}
    					}
    				}
    
    				if field.PrimaryKey {
    					schema.PrimaryFields = append(schema.PrimaryFields, field)
    				}
    			}
    		}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Oct 10 06:50:29 GMT 2023
    - 13.7K bytes
    - Viewed (0)
  6. model.go

    // It may be embedded into your model or you may build your own model without it
    //
    //	type User struct {
    //	  gorm.Model
    //	}
    type Model struct {
    	ID        uint `gorm:"primarykey"`
    	CreatedAt time.Time
    	UpdatedAt time.Time
    	DeletedAt DeletedAt `gorm:"index"`
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 18 01:06:43 GMT 2023
    - 396 bytes
    - Viewed (0)
  7. finisher_api.go

    func (db *DB) First(dest interface{}, conds ...interface{}) (tx *DB) {
    	tx = db.Limit(1).Order(clause.OrderByColumn{
    		Column: clause.Column{Table: clause.CurrentTable, Name: clause.PrimaryKey},
    	})
    	if len(conds) > 0 {
    		if exprs := tx.Statement.BuildCondition(conds[0], conds[1:]...); len(exprs) > 0 {
    			tx.Statement.AddClause(clause.Where{Exprs: exprs})
    		}
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  8. tests/create_test.go

    	company := Company{ID: 100, Name: "company100_with_primarykey"}
    	DB.FirstOrCreate(&company)
    
    	if company.ID != 100 {
    		t.Errorf("invalid primary key after creating, got %v", company.ID)
    	}
    
    	companies := []Company{
    		{ID: 101, Name: "company101_with_primarykey"},
    		{ID: 102, Name: "company102_with_primarykey"},
    	}
    	DB.Create(&companies)
    
    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)
  9. schema/field.go

    				}
    
    				if prefix, ok := field.TagSettings["EMBEDDEDPREFIX"]; ok && ef.DBName != "" {
    					ef.DBName = prefix + ef.DBName
    				}
    
    				if ef.PrimaryKey {
    					if !utils.CheckTruth(ef.TagSettings["PRIMARYKEY"], ef.TagSettings["PRIMARY_KEY"]) {
    						ef.PrimaryKey = false
    
    						if val, ok := ef.TagSettings["AUTOINCREMENT"]; !ok || !utils.CheckTruth(val) {
    							ef.AutoIncrement = false
    						}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 32K bytes
    - Viewed (1)
  10. migrator/migrator.go

    	}
    
    	// check nullable
    	if nullable, ok := columnType.Nullable(); ok && nullable == field.NotNull {
    		// not primary key & database is nullable
    		if !field.PrimaryKey && nullable {
    			alterColumn = true
    		}
    	}
    
    	// check default value
    	if !field.PrimaryKey {
    		currentDefaultNotNull := field.HasDefaultValue && (field.DefaultValueInterface != nil || !strings.EqualFold(field.DefaultValue, "NULL"))
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
Back to top