dal

package
v0.0.0-...-a12d374 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ComparatorEq  Comparator = 0
	ComparatorGt  Comparator = 1
	ComparatorGte Comparator = 2
	ComparatorLt  Comparator = 3
	ComparatorLte Comparator = 4
	ComparatorIn  Comparator = 5

	LogicOperatorAnd LogicOperator = 0
	LogicOperatorOr  LogicOperator = 1
)

Variables

View Source
var (
	ErrResolveRepo = errors.New("resolve repository")
)
View Source
var (
	OrderValue = map[Order]string{
		OrderAsc:  "ASC",
		OrderDesc: "DESC",
	}
)

Functions

func DecodeCursor

func DecodeCursor(c Cursor) int64

Types

type Comparator

type Comparator int

func (Comparator) String

func (c Comparator) String() string

type CompiledQuery

type CompiledQuery struct {
	String string
	Params map[string]interface{}
}

type Cursor

type Cursor string

func EncodeCursor

func EncodeCursor(value int64) Cursor

func (Cursor) IsEmpty

func (c Cursor) IsEmpty() bool

func (Cursor) MarshalJSON

func (c Cursor) MarshalJSON() ([]byte, error)

func (Cursor) String

func (c Cursor) String() string

type Definition

type Definition struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type Entity

type Entity struct {
	Metadata
	ID  string `json:"id"`
	Rev string `json:"rev"`
}

func (Entity) IsEmpty

func (e Entity) IsEmpty() bool

type Filtering

type Filtering struct {
	Fields   []FilteringField
	Operator LogicOperator
}

type FilteringField

type FilteringField struct {
	Name       string      `json:"name"`
	Value      interface{} `json:"value"`
	Comparator Comparator  `json:"comparator"`
}

type LogicOperator

type LogicOperator int

func (LogicOperator) String

func (l LogicOperator) String() string

type Metadata

type Metadata struct {
	CreatedAt *time.Time `json:"created_at,omitempty"`
	UpdateAt  *time.Time `json:"update_at,omitempty"`
}

type Order

type Order = uint64
const (
	OrderAsc  Order = 0
	OrderDesc Order = 1
)

type Pagination

type Pagination struct {
	Cursor Cursor `json:"cursor"`
	Count  uint64 `json:"count"`
}

func (*Pagination) String

func (p *Pagination) String() string

type Query

type Query struct {
	Pagination Pagination `json:"pagination"`
	Sorting    Sorting    `json:"sorting"`
	Filtering  Filtering  `json:"filtering"`
}

type QueryResult

type QueryResult struct {
	BeforeCursor Cursor `json:"before_cursor"`
	AfterCursor  Cursor `json:"after_cursor"`
	Count        uint64 `json:"count"`
}

type Sorting

type Sorting struct {
	Fields []*SortingField `json:"columns"`
}

type SortingField

type SortingField struct {
	Name  string `json:"name"`
	Order Order  `json:"order"`
}

Jump to

Keyboard shortcuts

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