Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for ParseIndexes (2.88 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() []*Index {
    	indexesByName := map[string]*Index{}
    	indexes := []*Index{}
    
    	for _, field := range schema.Fields {
    Registered: Sun Sep 07 09:35:13 UTC 2025
    - Last Modified: Wed May 21 02:35:56 UTC 2025
    - 3.8K bytes
    - Viewed (0)
  2. 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
    
    Registered: Sun Sep 07 09:35:13 UTC 2025
    - Last Modified: Fri Dec 06 02:27:44 UTC 2024
    - 7.9K bytes
    - Viewed (0)
  3. 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
    
    Registered: Sun Sep 07 09:35:13 UTC 2025
    - Last Modified: Fri Jun 06 02:35:01 UTC 2025
    - 29.5K 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 {
    Registered: Sun Sep 07 09:35:13 UTC 2025
    - Last Modified: Wed Aug 20 04:51:17 UTC 2025
    - 65.2K bytes
    - Viewed (0)
Back to top