selection_condition

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2021 License: MIT Imports: 7 Imported by: 23

Documentation

Index

Constants

View Source
const (
	SortOrderParamName = "sort_order"
	SortOrderAsc       = "asc"
	SortOrderDesc      = "desc"

	ConditionSeparator = "__"
	ValuesSeparator    = ","

	ConditionEq  = "eq"
	ConditionGt  = "gt"
	ConditionGte = "gte"
	ConditionLt  = "lt"
	ConditionLte = "lte"
	ConditionIn  = "in"
	ConditionBt  = "bt"
	ConditionTS  = "ts"

	DefaultWhereCondition = ConditionEq
	DefaultSortDirect     = SortOrderAsc
)

Variables

View Source
var SortOrderVariants = []interface{}{"", SortOrderAsc, SortOrderDesc}

Functions

func IntSlice2EmptyInterfaceSlice added in v0.0.4

func IntSlice2EmptyInterfaceSlice(sl []int) []interface{}

func ParseQueryParamsIntoStruct

func ParseQueryParamsIntoStruct(params map[string][]string, out interface{}) error

func ParseUintParam

func ParseUintParam(param string) (uint, error)

func UintSlice2EmptyInterfaceSlice added in v0.0.4

func UintSlice2EmptyInterfaceSlice(sl []uint) []interface{}

Types

type SelectionCondition

type SelectionCondition struct {
	Where     interface{}
	SortOrder []map[string]string
	Limit     uint
	Offset    uint
}

func ParseQueryParams

func ParseQueryParams(params map[string][]string, struc interface{}) (*SelectionCondition, error)

func (*SelectionCondition) Validate

func (e *SelectionCondition) Validate() error

type WhereCondition

type WhereCondition struct {
	Field     string
	Condition string
	Value     interface{}
}

func (WhereCondition) Validate

func (s WhereCondition) Validate() error

type WhereConditions

type WhereConditions []WhereCondition

func (WhereConditions) Validate

func (s WhereConditions) Validate() error

Jump to

Keyboard shortcuts

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