acquery

package
v0.0.0-...-3f675b9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFieldTwice = errors.New("arcah/acquery: some field was found twice")
View Source
var ErrInvalidFirstChar = errors.New("arcah/acquery: OrderField first char must be '+' or '-' (either asc or desc ordering)")
View Source
var ErrInvalidOrderFields = errors.New("arcah/acquery: invalid order fields provided")
View Source
var NoLimitPagination = Pagination{
	Offset: 0,
	Limit:  ^uint32(0),
}

Functions

This section is empty.

Types

type MongoEngine

type MongoEngine interface {
	CompileQuery(ctx context.Context, query interface{}) (err error)
}

type OrderField

type OrderField struct {
	Name string
	Desc bool
}

func (*OrderField) MarshalText

func (f *OrderField) MarshalText() ([]byte, error)

func (*OrderField) UnmarshalText

func (f *OrderField) UnmarshalText(data []byte) (err error)

type OrderFields

type OrderFields []OrderField

func (OrderFields) GetFields

func (fields OrderFields) GetFields() bson.D

func (*OrderFields) MarshalText

func (fields *OrderFields) MarshalText() (res []byte, err error)

func (*OrderFields) UnmarshalText

func (fields *OrderFields) UnmarshalText(data []byte) (err error)

type OrderSchema

type OrderSchema struct {
	AliasToField map[string]string
}

func (*OrderSchema) AddField

func (schema *OrderSchema) AddField(userAlias, dbName string) *OrderSchema

func (*OrderSchema) Process

func (schema *OrderSchema) Process(fields OrderFields) (res OrderFields)

Processes fields, and applies aliases

func (*OrderSchema) Validate

func (schema *OrderSchema) Validate(fields OrderFields) (err error)

type OrderSchemaFactory

type OrderSchemaFactory interface {
	CreateOrderSchema(ctx context.Context, ty reflect.Type) (schema *OrderSchema, err error)
}

func NewMongoOrderSchemaFactory

func NewMongoOrderSchemaFactory() OrderSchemaFactory

type Pagination

type Pagination struct {
	Offset uint32 `json:"offset" schema:"offset"`
	Limit  uint32 `json:"limit" schema:"limit"`
}

Base type of pagination used in acquery.

func (*Pagination) WithMaxLimit

func (p *Pagination) WithMaxLimit(limit uint32) Pagination

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL