Documentation ¶
Index ¶
- Constants
- Variables
- func WhereBetween(key string, min, max interface{}) *bson.E
- func WhereEq(key string, value interface{}) *bson.E
- func WhereGT(key string, value interface{}) *bson.E
- func WhereGTE(key string, value interface{}) *bson.E
- func WhereIn(key string, value []interface{}) *bson.E
- func WhereLT(key string, value interface{}) *bson.E
- func WhereLTE(key string, value interface{}) *bson.E
- func WhereLike(key string, like string) *bson.E
- func WhereNotBetween(key string, min, max interface{}) *bson.E
- func WhereNotEq(key string, value interface{}) *bson.E
- func WhereNotIn(key string, value []interface{}) *bson.E
- func WhereNotLike(key string, like string) *bson.E
- func WhereNotNull(key string) *bson.E
- func WhereNull(key string) *bson.E
- func WherePri(args []string) *bson.E
- type FilterRequest
- type PageInfo
- type PageRequest
- type PropertyFilter
- type SortDirection
- type SortParam
Constants ¶
View Source
const ( ConditionQueryPrefix = "condition{" ConditionQuerySuffix = "}" TagNameMulti = "multi" TagNameWildcard = "wildcard" )
Variables ¶
View Source
var ( SortDirection_name = map[SortDirection]string{ 0: "ASC", 1: "DESC", } SortDirection_value = map[string]SortDirection{ "ASC": 0, "DESC": 1, } )
Enum value maps for MultiType.
Functions ¶
func WhereBetween ¶
func WhereNotBetween ¶
func WhereNotEq ¶
func WhereNotIn ¶
func WhereNotNull ¶
func WherePri ¶
WherePri does the same logic as Model.Where except that if the parameter `where` is a single condition like int/string/float/slice, it treats the condition as the primary key value. That is, if primary key is "id" and given `where` parameter as "123", the WherePri function treats the condition as "id=123", but Model.Where treats the condition as string "123".
Types ¶
type FilterRequest ¶
type FilterRequest struct { PropertyFilters []*PropertyFilter Filters *bson.D }
func ExtractFilters ¶
func (*FilterRequest) GetFilters ¶
func (fr *FilterRequest) GetFilters() (*bson.D, error)
type PageInfo ¶
type PageInfo struct { Offset int64 // the offset of the first element in current page of the paging request Size int64 // page size of the paging request, may be larger than NumberOfElements Sorts []SortParam // the sorting parameters of the paging request Number int64 // page number of current page, starting from 1 NumberOfElements int64 // number of elements in current page TotalElements int64 // total number of elements for current request when without paging TotalPages int64 // total number of pages of the paging request First bool // whether current page is first page Last bool // whether current page is last page }
type PageRequest ¶
func NewPageRequest ¶
func NewPageRequest(page, size int64, sort ...string) *PageRequest
func (*PageRequest) AddSort ¶
func (pr *PageRequest) AddSort(sort SortParam) *PageRequest
func (*PageRequest) AddSortByString ¶
func (pr *PageRequest) AddSortByString(sort string) *PageRequest
func (*PageRequest) HasSort ¶
func (pr *PageRequest) HasSort() bool
func (*PageRequest) MongoSortOption ¶
func (pr *PageRequest) MongoSortOption() (result bson.D)
func (*PageRequest) OrderString ¶
func (pr *PageRequest) OrderString() string
type PropertyFilter ¶
type PropertyFilter struct { Property string `json:"property"` Value interface{} `json:"value"` Operator goguruTypes.OperatorType `json:"operator"` Multi goguruTypes.MultiType `json:"multi"` Wildcard goguruTypes.WildcardType `json:"wildcard"` }
type SortDirection ¶
type SortDirection uint8
todo make all struct protobuf defined
const ( SortDirection_ASC SortDirection = 0 SortDirection_DESC SortDirection = 1 )
type SortParam ¶
type SortParam struct { Property string Direction SortDirection }
Click to show internal directories.
Click to hide internal directories.