Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for ParseIndexes (0.18 sec)

  1. schema/index.go

    }
    
    type IndexOption struct {
    	*Field
    	Expression string
    	Sort       string // DESC, ASC
    	Collate    string
    	Length     int
    	priority   int
    }
    
    // ParseIndexes parse schema indexes
    func (schema *Schema) ParseIndexes() map[string]Index {
    	indexes := map[string]Index{}
    
    	for _, field := range schema.Fields {
    		if field.TagSettings["INDEX"] != "" || field.TagSettings["UNIQUEINDEX"] != "" {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 3.7K bytes
    - Viewed (0)
  2. migrator/migrator.go

    					return errors.New("failed to get schema")
    				}
    
    				columnTypes, err := queryTx.Migrator().ColumnTypes(value)
    				if err != nil {
    					return err
    				}
    				var (
    					parseIndexes          = stmt.Schema.ParseIndexes()
    					parseCheckConstraints = stmt.Schema.ParseCheckConstraints()
    				)
    				for _, dbName := range stmt.Schema.DBNames {
    					var foundColumn gorm.ColumnType
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  3. schema/index_test.go

    				Field: &schema.Field{Name: "Data2C"},
    			}, {
    				Field: &schema.Field{Name: "Data2A"},
    			}, {
    				Field: &schema.Field{Name: "Data2B"},
    			}},
    		},
    	}
    
    	CheckIndices(t, results, user.ParseIndexes())
    }
    
    func TestParseIndexWithUniqueIndexAndUnique(t *testing.T) {
    	type IndexTest struct {
    		FieldA string `gorm:"unique;index"` // unique and index
    		FieldB string `gorm:"unique"`       // unique
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 8K bytes
    - Viewed (0)
  4. tests/migrate_test.go

    		stmt := &gorm.Statement{DB: DB}
    		err := stmt.Parse(model)
    		if err != nil {
    			t.Fatalf("%v: failed to parse schema, got error: %v", utils.FileWithLineNum(), err)
    		}
    		_ = stmt.Schema.ParseIndexes()
    		field := stmt.Schema.LookUpField(fieldName)
    		if field == nil {
    			t.Fatalf("%v: failed to find column %q", utils.FileWithLineNum(), fieldName)
    		}
    		if field.Unique != unique {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
Back to top