Documentation ¶
Index ¶
- Constants
- Variables
- func BackQuote(exp string) string
- func CauseIter(err error, iter func(er error)) error
- func ErrorCompose(a, b error) error
- func MapKeys(m map[string]interface{}) []string
- func MapQuote(mapper func(string) string) func(src ...string) []string
- func Quote(exp string) string
- func Repeat(n int, s string) []string
- type ConditionBuildEngine
- type ConditionFunctor
- type ConditionResult
- type ConditionStmt
- func And(e ...map[string]interface{}) ConditionStmt
- func Equal(a string, b interface{}) ConditionStmt
- func GT(a string, b interface{}) ConditionStmt
- func GTE(a string, b interface{}) ConditionStmt
- func In(a string, b ...interface{}) ConditionStmt
- func IsNull(a string) ConditionStmt
- func LT(a string, b interface{}) ConditionStmt
- func LTE(a string, b interface{}) ConditionStmt
- func Like(a string, b interface{}) ConditionStmt
- func Not(b interface{}) ConditionStmt
- func Or(e ...map[string]interface{}) ConditionStmt
- type ConditionStmtBuilder
- type ConditionStmtResolver
- type ConditionStmtResolverSet
- type ConditoinContent
- type FakeConditionStmtBuildEngine
- type FakeOrderStmtBuildEngine
- type FakePaginationStmtBuildEngine
- type OrderBuildEngine
- type OrderContent
- type OrderFunctor
- type OrderResult
- type OrderStmt
- type OrderStmtBuilder
- type OrderStmtResolver
- type OrderStmtResolverSet
- type PaginationBuildEngine
- type PaginationContent
- type PaginationFunctor
- type PaginationResult
- type PaginationStmt
- func (page PaginationStmt) Build(engine PaginationBuildEngine) (PaginationResult, error)
- func (page PaginationStmt) Limit() (int, bool)
- func (page PaginationStmt) Page() (int, bool)
- func (page PaginationStmt) SetLimit(l int) (PaginationStmt, error)
- func (page PaginationStmt) SetPage(p int) (PaginationStmt, error)
- type PaginationStmtBuilder
- type PaginationStmtResolver
- type PaginationStmtResolverSet
- type ResolverSelector
- type TypeMap
- type TypeOrderStmt
- type TypeSlice
Constants ¶
View Source
const ( DEFAULT_PAGINATION_LIMIT = math.MaxInt8 DEFAULT_PAGINATION_PAGE = 1 )
Variables ¶
View Source
var ( ErrorInvalidArgumentEmptyString = fmt.Errorf("empty string") ErrorInvalidArgumentEmptyObject = fmt.Errorf("empty object") ErrorNotFoundHandler = fmt.Errorf("not found handler") ErrorUnsupportedType = fmt.Errorf("unsupported type") ErrorUnsupportedPaginationKeys = fmt.Errorf("unsupported pagination keys") ErrorUnsupportedOrderKeys = fmt.Errorf("unsupported order keys") )
View Source
var ( // export for resolver's SetConditionStmtBuilder SetConditionStmtBuilder = collection.SetConditionStmtBuilder // export for resolver's SetOrderStmtBuilder SetOrderStmtBuilder = collection.SetOrderStmtBuilder // export for resolver's SetPaginationStmtBuilder SetPaginationStmtBuilder = collection.SetPaginationStmtBuilder // get condition resolver GetConditionStmtBuilder = collection.ConditionStmtBuilder // get order resolver GetOrderStmtBuilder = collection.OrderStmtBuilder // get pagination resolver GetPaginationStmtBuilder = collection.PaginationStmtBuilder )
View Source
var ConditionLexer = new(conditionLexer)
View Source
var OrderLexer = new(orderLexer)
View Source
var PaginationLexer = new(paginationLexer)
Functions ¶
func ErrorCompose ¶
Types ¶
type ConditionBuildEngine ¶
type ConditionBuildEngine struct {
// contains filtered or unexported fields
}
ConditionBuildEngine
implement of ConditionStmtResolver
func NewConditionBuildEngine ¶
func NewConditionBuildEngine(dialect string, builtinSet map[string]ConditionFunctor) *ConditionBuildEngine
func (ConditionBuildEngine) Build ¶
func (engine ConditionBuildEngine) Build(v interface{}) (ConditionResult, error)
func (ConditionBuildEngine) Dialect ¶
func (engine ConditionBuildEngine) Dialect() string
type ConditionFunctor ¶
type ConditionFunctor = func(v interface{}) (ConditionResult, error)
type ConditionResult ¶
type ConditionResult interface { Query() string Args() []interface{} }
type ConditionStmt ¶
type ConditionStmt map[string]interface{}
func And ¶
func And(e ...map[string]interface{}) ConditionStmt
func Equal ¶
func Equal(a string, b interface{}) ConditionStmt
func GT ¶
func GT(a string, b interface{}) ConditionStmt
func GTE ¶
func GTE(a string, b interface{}) ConditionStmt
func In ¶
func In(a string, b ...interface{}) ConditionStmt
func IsNull ¶
func IsNull(a string) ConditionStmt
func LT ¶
func LT(a string, b interface{}) ConditionStmt
func LTE ¶
func LTE(a string, b interface{}) ConditionStmt
func Like ¶
func Like(a string, b interface{}) ConditionStmt
func Not ¶
func Not(b interface{}) ConditionStmt
func Or ¶
func Or(e ...map[string]interface{}) ConditionStmt
func (ConditionStmt) Build ¶
func (condition ConditionStmt) Build(engine ConditionBuildEngine) (ConditionResult, error)
func (ConditionStmt) Keys ¶
func (condition ConditionStmt) Keys() []string
type ConditionStmtBuilder ¶
type ConditionStmtBuilder interface { Build(v interface{}) (ConditionResult, error) Dialect() string }
type ConditionStmtResolver ¶
type ConditionStmtResolver = interface { ConditionStmtBuilder ConditoinContent }
type ConditionStmtResolverSet ¶
type ConditionStmtResolverSet = map[string]ConditionStmtResolver
type ConditoinContent ¶
type ConditoinContent interface { And(v interface{}) (ConditionResult, error) Or(v interface{}) (ConditionResult, error) Not(v interface{}) (ConditionResult, error) Equal(v interface{}) (ConditionResult, error) GreaterThan(v interface{}) (ConditionResult, error) LessThan(v interface{}) (ConditionResult, error) GreaterThanOrEqual(v interface{}) (ConditionResult, error) LessThanOrEqual(v interface{}) (ConditionResult, error) Like(v interface{}) (ConditionResult, error) IsNull(v interface{}) (ConditionResult, error) In(v interface{}) (ConditionResult, error) Between(v interface{}) (ConditionResult, error) }
type FakeConditionStmtBuildEngine ¶
type FakeConditionStmtBuildEngine struct {
// contains filtered or unexported fields
}
func (FakeConditionStmtBuildEngine) Build ¶
func (engine FakeConditionStmtBuildEngine) Build(v interface{}) (ConditionResult, error)
func (FakeConditionStmtBuildEngine) Dialect ¶
func (engine FakeConditionStmtBuildEngine) Dialect() string
type FakeOrderStmtBuildEngine ¶
type FakeOrderStmtBuildEngine struct {
// contains filtered or unexported fields
}
func (FakeOrderStmtBuildEngine) Build ¶
func (engine FakeOrderStmtBuildEngine) Build(v interface{}) (OrderResult, error)
func (FakeOrderStmtBuildEngine) Dialect ¶
func (engine FakeOrderStmtBuildEngine) Dialect() string
type FakePaginationStmtBuildEngine ¶
type FakePaginationStmtBuildEngine struct {
// contains filtered or unexported fields
}
func (FakePaginationStmtBuildEngine) Build ¶
func (engine FakePaginationStmtBuildEngine) Build(v interface{}) (PaginationResult, error)
func (FakePaginationStmtBuildEngine) Dialect ¶
func (engine FakePaginationStmtBuildEngine) Dialect() string
type OrderBuildEngine ¶
type OrderBuildEngine struct {
// contains filtered or unexported fields
}
OrderBuildEngine
implement of OrderStmtResolver
func NewOrderBuildEngine ¶
func NewOrderBuildEngine(dialect string, builtinSet map[string]OrderFunctor) *OrderBuildEngine
func (OrderBuildEngine) Build ¶
func (engine OrderBuildEngine) Build(v interface{}) (OrderResult, error)
func (OrderBuildEngine) Dialect ¶
func (engine OrderBuildEngine) Dialect() string
type OrderContent ¶
type OrderContent interface { Asc(v interface{}) (OrderResult, error) Desc(v interface{}) (OrderResult, error) }
type OrderFunctor ¶
type OrderFunctor = func(v interface{}) (OrderResult, error)
type OrderResult ¶
type OrderResult interface { Order() string // Order() string Combine(OrderResult) OrderResult }
type OrderStmt ¶
type OrderStmt []TypeOrderStmt
OrderStmt
map[string][]string{"ASC": []string{column1, column2}, "DESC": []string{column3, column4} }
func (OrderStmt) Build ¶
func (order OrderStmt) Build(engine OrderBuildEngine) (OrderResult, error)
type OrderStmtBuilder ¶
type OrderStmtBuilder interface { Build(v interface{}) (OrderResult, error) Dialect() string }
type OrderStmtResolver ¶
type OrderStmtResolver = interface { OrderStmtBuilder OrderContent }
type OrderStmtResolverSet ¶
type OrderStmtResolverSet = map[string]OrderStmtResolver
type PaginationBuildEngine ¶
type PaginationBuildEngine struct {
// contains filtered or unexported fields
}
PaginationBuildEngine
implement of PaginationStmtResolver
func NewPaginationBuildEngine ¶
func NewPaginationBuildEngine(dialect string, builtinSet map[string]PaginationFunctor) *PaginationBuildEngine
func (PaginationBuildEngine) Build ¶
func (engine PaginationBuildEngine) Build(v interface{}) (PaginationResult, error)
func (PaginationBuildEngine) Dialect ¶
func (engine PaginationBuildEngine) Dialect() string
type PaginationContent ¶
type PaginationContent interface { Limit(v interface{}) (PaginationResult, error) Page(v interface{}) (PaginationResult, error) }
type PaginationFunctor ¶
type PaginationFunctor = func(v interface{}) (PaginationResult, error)
type PaginationResult ¶
type PaginationStmt ¶
func Limit ¶
func Limit(limit int, page ...int) PaginationStmt
func (PaginationStmt) Build ¶
func (page PaginationStmt) Build(engine PaginationBuildEngine) (PaginationResult, error)
func (PaginationStmt) Limit ¶
func (page PaginationStmt) Limit() (int, bool)
func (PaginationStmt) Page ¶
func (page PaginationStmt) Page() (int, bool)
func (PaginationStmt) SetLimit ¶
func (page PaginationStmt) SetLimit(l int) (PaginationStmt, error)
func (PaginationStmt) SetPage ¶
func (page PaginationStmt) SetPage(p int) (PaginationStmt, error)
type PaginationStmtBuilder ¶
type PaginationStmtBuilder interface { Build(v interface{}) (PaginationResult, error) Dialect() string }
type PaginationStmtResolver ¶
type PaginationStmtResolver = interface { PaginationStmtBuilder PaginationContent }
type PaginationStmtResolverSet ¶
type PaginationStmtResolverSet = map[string]PaginationStmtResolver
type ResolverSelector ¶
type ResolverSelector interface {
Dialect() string
}
type TypeOrderStmt ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.