Documentation ¶
Index ¶
- Constants
- Variables
- type FilterRequest
- type Model
- func AddCondition(_ context.Context, columnName string, condition *PropertyFilter, m *Model) (*Model, error)
- func AddCondition1(columnName string, condition *gwtypes.Condition, m *Model) (*Model, error)
- func ApplyFilter(ctx context.Context, request FilterRequest, m *Model) (output *Model, err error)
- func ApplyPropertyFilter(_ context.Context, condition *PropertyFilter, m *Model) (*Model, error)
- func ParseConditions(ctx context.Context, req interface{}, columnMap map[string]string, m *Model) (*Model, error)
- func (m *Model) Count(ctx context.Context) (int64, error)
- func (m *Model) Delete(ctx context.Context, where ...interface{}) (*Result, error)
- func (m *Model) Fields(fieldNamesOrMapStruct ...interface{}) *Model
- func (m *Model) FieldsEx(fieldNamesOrMapStruct ...interface{}) *Model
- func (m *Model) InsertOne(ctx context.Context, req interface{}) (*Result, error)
- func (m *Model) Limit(limit ...int) *Model
- func (m *Model) Order(orderBy ...interface{}) *Model
- func (m *Model) Page(page, limit int) *Model
- func (m *Model) Scan(ctx context.Context, pointer interface{}, where ...interface{}) error
- func (m *Model) Update(ctx context.Context, data interface{}) (*Result, error)
- func (m *Model) Upsert(ctx context.Context, data interface{}) (*Result, error)
- func (m *Model) Where(where interface{}, args ...interface{}) *Model
- func (m *Model) WhereBetween(column string, min, max interface{}) *Model
- func (m *Model) WhereGT(column string, value interface{}) *Model
- func (m *Model) WhereGTE(column string, value interface{}) *Model
- func (m *Model) WhereIn(column string, in interface{}) *Model
- func (m *Model) WhereLT(column string, value interface{}) *Model
- func (m *Model) WhereLTE(column string, value interface{}) *Model
- func (m *Model) WhereLike(column string, like string) *Model
- func (m *Model) WhereNot(column string, value interface{}) *Model
- func (m *Model) WhereNotBetween(column string, min, max interface{}) *Model
- func (m *Model) WhereNotIn(column string, in interface{}) *Model
- func (m *Model) WhereNotLike(column string, like string) *Model
- func (m *Model) WhereNotNull(column ...string) *Model
- func (m *Model) WhereNull(column ...string) *Model
- func (m *Model) WherePri(where interface{}, args ...interface{}) *Model
- func (m *Model) WithAll() *Model
- type ModelType
- type PageInfo
- type PageRequest
- type PropertyFilter
- type Result
- type SortDirection
- type SortParam
Constants ¶
View Source
const ( ConditionQueryPrefix = "condition{" ConditionQuerySuffix = "}" TagNameMulti = "multi" TagNameWildcard = "wildcard" )
todo gworm package is deprecated
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 ¶
This section is empty.
Types ¶
type FilterRequest ¶
type FilterRequest struct {
PropertyFilters []*PropertyFilter
}
func ExtractFilters ¶
func (*FilterRequest) AddPropertyFilter ¶
func (fr *FilterRequest) AddPropertyFilter(f *PropertyFilter) *FilterRequest
type Model ¶
func AddCondition ¶
func AddCondition1 ¶
func ApplyFilter ¶
func ApplyPropertyFilter ¶
func ParseConditions ¶
func ParseConditions(ctx context.Context, req interface{}, columnMap map[string]string, m *Model) (*Model, error)
ParseConditions 根据传入 query 结构指针的值来设定 Where 条件 ctx context queryPtr 传入 query 结构指针的值 columnMap 表的字段定义map,key为GoField,value为表字段名 m gdb.Model
func (*Model) WhereBetween ¶
func (*Model) WhereNotBetween ¶
func (*Model) WhereNotIn ¶
func (*Model) WhereNotNull ¶
type PageInfo ¶
type PageInfo struct { Offset uint64 // the offset of the first element in current page of the paging request Size uint32 // page size of the paging request, may be larger than NumberOfElements Sorts []SortParam // the sorting parameters of the paging request Number uint32 // page number of current page, starting from 1 NumberOfElements uint32 // number of elements in current page TotalElements uint64 // total number of elements for current request when without paging TotalPages uint32 // 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 (PageRequest) AddSort ¶
func (pr PageRequest) AddSort(sort SortParam) PageRequest
func (PageRequest) AddSortByString ¶
func (pr PageRequest) AddSortByString(sort string) PageRequest
func (PageRequest) Of ¶
func (pr PageRequest) Of(page, size uint32, sort ...SortParam) PageRequest
func (PageRequest) OrderString ¶
func (pr PageRequest) OrderString() string
type PropertyFilter ¶
type PropertyFilter struct { Property string `json:"property"` Value interface{} `json:"value"` Operator gwtypes.OperatorType `json:"operator"` Multi gwtypes.MultiType `json:"multi"` Wildcard gwtypes.WildcardType `json:"wildcard"` }
func AddConditionFilter ¶
type SortDirection ¶
type SortDirection uint8
const ( SortDirection_ASC SortDirection = 0 SortDirection_DESC SortDirection = 1 )
type SortParam ¶
type SortParam struct { Property string Direction SortDirection }
Directories ¶
Path | Synopsis |
---|---|
internal/reflection
Package reflection provides some reflection functions for internal usage.
|
Package reflection provides some reflection functions for internal usage. |
Click to show internal directories.
Click to hide internal directories.