Documentation ¶
Index ¶
- type BaseSpecification
- func (b *BaseSpecification) FilterByID(id string) specification.Set
- func (b *BaseSpecification) FilterEntry(attributes map[string]interface{}) specification.Set
- func (b *BaseSpecification) GetPreloadIndex(field string) int
- func (b *BaseSpecification) GreaterThan(field string, value interface{}) specification.Set
- func (b *BaseSpecification) LessThan(field string, value interface{}) specification.Set
- func (b *BaseSpecification) Limit(limit int) specification.Set
- func (b *BaseSpecification) NeedsPreload(field string) (bool, []bson.M)
- func (b *BaseSpecification) PreQueryHook()
- func (b *BaseSpecification) Prefetch(preload ...string) specification.Set
- func (b *BaseSpecification) Query() interface{}
- func (b *BaseSpecification) ReplacePreload(field string, preload []bson.M) specification.Set
- func (b *BaseSpecification) Sort(sortBy string, sortOrder sort.Order) specification.Set
- func (b *BaseSpecification) WithContext(ctx context.Context) specification.Set
- type BsonO
- type ExtendedSpecifications
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseSpecification ¶
type BaseSpecification struct {
// contains filtered or unexported fields
}
BaseSpecification is the base specification for all mongo specifications.
func NewBaseSpecification ¶
func NewBaseSpecification() *BaseSpecification
NewBaseSpecification creates a new base specification.
func (*BaseSpecification) FilterByID ¶
func (b *BaseSpecification) FilterByID(id string) specification.Set
FilterByID adds a filter to the specification by ID (primary key).
func (*BaseSpecification) FilterEntry ¶
func (b *BaseSpecification) FilterEntry(attributes map[string]interface{}) specification.Set
Filter adds filters to the specification.
func (*BaseSpecification) GetPreloadIndex ¶
func (b *BaseSpecification) GetPreloadIndex(field string) int
func (*BaseSpecification) GreaterThan ¶
func (b *BaseSpecification) GreaterThan(field string, value interface{}) specification.Set
func (*BaseSpecification) LessThan ¶
func (b *BaseSpecification) LessThan(field string, value interface{}) specification.Set
func (*BaseSpecification) Limit ¶
func (b *BaseSpecification) Limit(limit int) specification.Set
Limit adds a limit to the specification.
func (*BaseSpecification) NeedsPreload ¶
func (b *BaseSpecification) NeedsPreload(field string) (bool, []bson.M)
NeedsPreload requires overriding in the child.
func (*BaseSpecification) PreQueryHook ¶
func (b *BaseSpecification) PreQueryHook()
PreQueryHook is called before the query is executed It's either empty or overridden by the child.
func (*BaseSpecification) Prefetch ¶
func (b *BaseSpecification) Prefetch(preload ...string) specification.Set
Prefetch adds preloads to the specification.
func (*BaseSpecification) Query ¶
func (b *BaseSpecification) Query() interface{}
Query returns the query to be used in the database Order of operations: 1. PreQueryHook 2. Filters 3. Preload 4. PostFilters 5. Sort 6. Limit.
func (*BaseSpecification) ReplacePreload ¶
func (b *BaseSpecification) ReplacePreload(field string, preload []bson.M) specification.Set
func (*BaseSpecification) Sort ¶
func (b *BaseSpecification) Sort(sortBy string, sortOrder sort.Order) specification.Set
Sort adds a sort to the specification.
func (*BaseSpecification) WithContext ¶
func (b *BaseSpecification) WithContext(ctx context.Context) specification.Set
WithContext adds a context to the specification.