Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for autoincrement (0.22 sec)

  1. schema/schema_test.go

    		Name: "ProductID", DBName: "product_id", BindNames: []string{"ProductID"}, DataType: schema.Uint, PrimaryKey: true, Size: 64, HasDefaultValue: true, AutoIncrement: true, TagSettings: map[string]string{"PRIMARYKEY": "PRIMARYKEY", "AUTOINCREMENT": "AUTOINCREMENT"},
    	}
    
    	product.Fields = []*schema.Field{product.PrioritizedPrimaryField}
    
    	checkSchemaField(t, product, &prioritizedPrimaryField, func(f *schema.Field) {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 12.9K bytes
    - Viewed (0)
  2. tests/postgres_test.go

    		t.Fatalf("failed to get columns, got error %v", err)
    	}
    
    	hasLogID := false
    	for _, column := range columns {
    		if column.Name() == "log_id" {
    			hasLogID = true
    			autoIncrement, ok := column.AutoIncrement()
    			if !ok || !autoIncrement {
    				t.Fatalf("column log_id should be auto incrementment")
    			}
    		}
    	}
    
    	if !hasLogID {
    		t.Fatalf("failed to found column log_id")
    	}
    }
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Oct 08 09:16:32 GMT 2022
    - 6.4K bytes
    - Viewed (3)
  3. migrator/column_type.go

    func (ct ColumnType) PrimaryKey() (isPrimaryKey bool, ok bool) {
    	return ct.PrimaryKeyValue.Bool, ct.PrimaryKeyValue.Valid
    }
    
    // AutoIncrement returns the column is auto increment or not.
    func (ct ColumnType) AutoIncrement() (isAutoIncrement bool, ok bool) {
    	return ct.AutoIncrementValue.Bool, ct.AutoIncrementValue.Valid
    }
    
    // Length returns the column type length for variable length column types
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Mar 24 01:31:58 GMT 2022
    - 3.3K bytes
    - Viewed (0)
  4. schema/schema.go

    			schema.PrioritizedPrimaryField = schema.PrimaryFields[0]
    		} else if len(schema.PrimaryFields) > 1 {
    			// If there are multiple primary keys, the AUTOINCREMENT field is prioritized
    			for _, field := range schema.PrimaryFields {
    				if field.AutoIncrement {
    					schema.PrioritizedPrimaryField = field
    					break
    				}
    			}
    		}
    	}
    
    	for _, field := range schema.PrimaryFields {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Oct 10 06:50:29 GMT 2023
    - 13.7K bytes
    - Viewed (0)
  5. schema/field.go

    		Updatable:              true,
    		Readable:               true,
    		PrimaryKey:             utils.CheckTruth(tagSetting["PRIMARYKEY"], tagSetting["PRIMARY_KEY"]),
    		AutoIncrement:          utils.CheckTruth(tagSetting["AUTOINCREMENT"]),
    		HasDefaultValue:        utils.CheckTruth(tagSetting["AUTOINCREMENT"]),
    		NotNull:                utils.CheckTruth(tagSetting["NOT NULL"], tagSetting["NOTNULL"]),
    		Unique:                 utils.CheckTruth(tagSetting["UNIQUE"]),
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 32K bytes
    - Viewed (1)
  6. migrator.go

    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)
    	Unique() (unique bool, ok bool)
    	ScanType() reflect.Type
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  7. schema/field_test.go

    	}
    
    	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},
    		{Name: "Name", DBName: "", BindNames: []string{"Name"}, DataType: "", Tag: `gorm:"-"`, Creatable: false, Updatable: false, Readable: false},
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Feb 19 09:02:53 GMT 2022
    - 12.7K bytes
    - Viewed (0)
  8. schema/relationship.go

    			Name:    joinFieldName,
    			PkgPath: ownField.StructField.PkgPath,
    			Type:    ownField.StructField.Type,
    			Tag: removeSettingFromTag(appendSettingFromTag(ownField.StructField.Tag, "primaryKey"),
    				"column", "autoincrement", "index", "unique", "uniqueindex"),
    		})
    	}
    
    	for idx, relField := range refForeignFields {
    		joinFieldName := strings.Title(relation.FieldSchema.Name) + relField.Name
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 22.4K bytes
    - Viewed (0)
  9. schema/schema_helper_test.go

    		}
    
    		if !ok {
    			t.Errorf("schema %v failed to look up field with name %v", s, f.Name)
    		} else {
    			tests.AssertObjEqual(t, parsedField, f, "Name", "DBName", "BindNames", "DataType", "PrimaryKey", "AutoIncrement", "Creatable", "Updatable", "Readable", "HasDefaultValue", "DefaultValue", "NotNull", "Unique", "Comment", "Size", "Precision", "TagSettings")
    
    			if f.DBName != "" {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  10. tests/embedded_struct_test.go

    		if DB.Dialector.Name() != "sqlite" {
    			t.Errorf("Failed to auto migrate advanced user, got error %v", err)
    		}
    	}
    }
    
    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
    	}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Oct 26 03:58:13 GMT 2023
    - 7.3K bytes
    - Viewed (0)
Back to top