Documentation
¶
Overview ¶
Package index holds the index builders used in an entity schema.
Index ¶
- type Column
- type Index
- func (i Index) Asc(fields ...string) IndexOperations
- func (i Index) Desc(fields ...string) IndexOperations
- func (i Index) GetColumns() []Column
- func (i Index) GetFields() []string
- func (i Index) GetName() string
- func (i Index) GetType() Type
- func (Index) Index()
- func (i Index) IsUnique() bool
- func (i Index) Name(name string) IndexOperations
- func (i Index) Unique() IndexOperations
- type IndexBuilder
- type IndexOperations
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Column ¶
type Column struct {
// contains filtered or unexported fields
}
Column is a single indexed column together with its sort direction.
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index holds the state of one index.
func (Index) Asc ¶
func (i Index) Asc(fields ...string) IndexOperations
Asc appends columns sorted ascending.
func (Index) Desc ¶
func (i Index) Desc(fields ...string) IndexOperations
Desc appends columns sorted descending.
func (Index) GetColumns ¶
GetColumns returns the columns with their sort direction, in order.
func (Index) Name ¶
func (i Index) Name(name string) IndexOperations
Name overrides the auto-generated index name.
func (Index) Unique ¶
func (i Index) Unique() IndexOperations
Unique turns the index into a unique constraint.
type IndexBuilder ¶
type IndexBuilder interface {
Index()
}
IndexBuilder is implemented by every index.
func Primary ¶
func Primary(fields ...string) IndexBuilder
Primary declares the primary key over the given fields. It replaces the generated id column, which is left out of the table.
type IndexOperations ¶
type IndexOperations interface {
IndexBuilder
// Unique turns the index into a unique constraint.
Unique() IndexOperations
// Name overrides the auto-generated index name
Name(name string) IndexOperations
// Asc appends columns sorted ascending.
Asc(fields ...string) IndexOperations
// Desc appends columns sorted descending.
Desc(fields ...string) IndexOperations
}
IndexOperations exposes the fluent modifiers available on a secondary index.
func Asc ¶ added in v0.0.6
func Asc(fields ...string) IndexOperations
Asc declares a secondary index whose first columns are sorted ascending. Chain Asc or Desc to append more columns, e.g. Asc("is_active").Desc("created_at").
func Desc ¶ added in v0.0.6
func Desc(fields ...string) IndexOperations
Desc declares a secondary index whose first columns are sorted descending. Chain Asc or Desc to append more columns, e.g. Desc("created_at").Asc("id").