Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 18 for Index (0.15 sec)

  1. schema/index.go

    				})
    
    				indexes[index.Name] = idx
    			}
    		}
    	}
    	for _, index := range indexes {
    		if index.Class == "UNIQUE" && len(index.Fields) == 1 {
    			index.Fields[0].Field.UniqueIndex = index.Name
    		}
    	}
    	return indexes
    }
    
    func (schema *Schema) LookIndex(name string) *Index {
    	if schema != nil {
    		indexes := schema.ParseIndexes()
    		for _, index := range indexes {
    			if index.Name == name {
    				return &index
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 3.7K bytes
    - Viewed (0)
  2. migrator/index.go

    import "database/sql"
    
    // Index implements gorm.Index interface
    type Index struct {
    	TableName       string
    	NameValue       string
    	ColumnList      []string
    	PrimaryKeyValue sql.NullBool
    	UniqueValue     sql.NullBool
    	OptionValue     string
    }
    
    // Table return the table name of the index.
    func (idx Index) Table() string {
    	return idx.TableName
    }
    
    // Name return the name of the index.
    func (idx Index) Name() string {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Apr 11 02:32:46 GMT 2023
    - 1023 bytes
    - Viewed (0)
  3. schema/index_test.go

    	OID          int64  `gorm:"index:idx_id;index:idx_oid,unique"`
    	MemberNumber string `gorm:"index:idx_id,priority:1"`
    	Name7        string `gorm:"index:type"`
    	Name8        string `gorm:"index:,length:10;index:,collate:utf8"`
    
    	// Composite Index: Flattened structure.
    	Data0A string `gorm:"index:,composite:comp_id0"`
    	Data0B string `gorm:"index:,composite:comp_id0"`
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Feb 04 07:49:19 GMT 2024
    - 8K bytes
    - Viewed (0)
  4. callbacks.go

    	c.name = name
    	c.handler = fn
    	c.replace = true
    	c.processor.callbacks = append(c.processor.callbacks, c)
    	return c.processor.compile()
    }
    
    // getRIndex get right index from string slice
    func getRIndex(strs []string, str string) int {
    	for i := len(strs) - 1; i >= 0; i-- {
    		if strs[i] == str {
    			return i
    		}
    	}
    	return -1
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 26 03:33:36 GMT 2024
    - 8.6K bytes
    - Viewed (1)
  5. clause/expression.go

    						if rv.Len() == 0 {
    							builder.AddVar(builder, nil)
    						} else {
    							for i := 0; i < rv.Len(); i++ {
    								if i > 0 {
    									builder.WriteByte(',')
    								}
    								builder.AddVar(builder, rv.Index(i).Interface())
    							}
    						}
    					default:
    						builder.AddVar(builder, expr.Vars[idx])
    					}
    				}
    			} else {
    				builder.AddVar(builder, expr.Vars[idx])
    			}
    
    			idx++
    		} else {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Oct 10 06:45:48 GMT 2023
    - 8.3K bytes
    - Viewed (0)
  6. migrator.go

    	Nullable() (nullable bool, ok bool)
    	Unique() (unique bool, ok bool)
    	ScanType() reflect.Type
    	Comment() (value string, ok bool)
    	DefaultValue() (value string, ok bool)
    }
    
    type Index interface {
    	Table() string
    	Name() string
    	Columns() []string
    	PrimaryKey() (isPrimaryKey bool, ok bool)
    	Unique() (unique bool, ok bool)
    	Option() string
    }
    
    // TableType table type interface
    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)
  7. utils/tests/utils.go

    					for i := 0; i < reflect.ValueOf(got).Len(); i++ {
    						name := fmt.Sprintf(reflect.ValueOf(got).Type().Name()+" #%v", i)
    						t.Run(name, func(t *testing.T) {
    							AssertEqual(t, reflect.ValueOf(got).Index(i).Interface(), reflect.ValueOf(expect).Index(i).Interface())
    						})
    					}
    				} else {
    					name := reflect.ValueOf(got).Type().Elem().Name()
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Mar 10 09:21:56 GMT 2023
    - 3.9K bytes
    - Viewed (0)
  8. schema/naming_test.go

    		TablePrefix:   "public.",
    		SingularTable: true,
    		NameReplacer:  strings.NewReplacer("CID", "Cid"),
    	}
    	idxName := ns.IndexName("public.table", "name")
    
    	if idxName != "idx_public_table_name" {
    		t.Errorf("invalid index name generated, got %v", idxName)
    	}
    
    	chkName := ns.CheckerName("public.table", "name")
    	if chkName != "chk_public_table_name" {
    		t.Errorf("invalid checker name generated, got %v", chkName)
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue May 30 02:00:48 GMT 2023
    - 7K bytes
    - Viewed (0)
  9. model.go

    //
    //	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)
  10. schema/naming.go

    }
    
    // CheckerName generate checker name
    func (ns NamingStrategy) CheckerName(table, column string) string {
    	return ns.formatName("chk", table, column)
    }
    
    // IndexName generate index name
    func (ns NamingStrategy) IndexName(table, column string) string {
    	return ns.formatName("idx", table, ns.toDBName(column))
    }
    
    // UniqueName generate unique constraint name
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 5.2K bytes
    - Viewed (0)
Back to top