Documentation
¶
Index ¶
- func Count(o interface{}, query interface{}) (int64, error)
- func Create(ctx *Context, o interface{}) error
- func Delete(ctx *Context, o interface{}) error
- func DeleteBy(o interface{}, query interface{}) error
- func FilterFieldsByProtected(obj interface{}, protected bool) map[string]interface{}
- func Get(o interface{}) (bool, error)
- func GetIndexName(o interface{}) string
- func GetWildcardIndexName(o interface{}) string
- func GroupBy(o interface{}, selectField, groupField, haveQuery string, ...) (error, map[string]interface{})
- func InitSchema() error
- func MustRegisterSchemaWithIndexName(t interface{}, index string)
- func Register(name string, h ORM)
- func RegisterSchemaWithIndexName(t interface{}, index string) error
- func Save(ctx *Context, o interface{}) error
- func Update(ctx *Context, o interface{}) error
- func UpdateBy(o interface{}, query interface{}) error
- type BoolType
- type Cond
- func And(conds ...*Cond) []*Cond
- func Combine(conds ...[]*Cond) []*Cond
- func Eq(field string, value interface{}) *Cond
- func Ge(field string, value interface{}) *Cond
- func Gt(field string, value interface{}) *Cond
- func In(field string, value []interface{}) *Cond
- func InStringArray(field string, value []string) *Cond
- func Le(field string, value interface{}) *Cond
- func Lt(field string, value interface{}) *Cond
- func NotEq(field string, value interface{}) *Cond
- func Or(conds ...*Cond) []*Cond
- type Context
- type ORM
- type ORMObjectBase
- type Object
- type ProtectedFilterKeyType
- type Query
- type QueryType
- type Result
- type Sort
- type SortType
- type TemplatedQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterFieldsByProtected ¶
FilterFieldsByProtected filter struct fields by tag protected recursively, returns a filtered fields map
func GetIndexName ¶
func GetIndexName(o interface{}) string
func GetWildcardIndexName ¶
func GetWildcardIndexName(o interface{}) string
func InitSchema ¶
func InitSchema() error
func MustRegisterSchemaWithIndexName ¶
func MustRegisterSchemaWithIndexName(t interface{}, index string)
Types ¶
type BoolType ¶
type BoolType string
const Must BoolType = "must"
const MustNot BoolType = "must_not"
const Should BoolType = "should"
type Cond ¶
type Cond struct { Field string SQLOperator string QueryType QueryType BoolType BoolType Value interface{} }
func InStringArray ¶
type ORM ¶
type ORM interface { RegisterSchemaWithIndexName(t interface{}, indexName string) error GetIndexName(o interface{}) string GetWildcardIndexName(o interface{}) string Save(ctx *Context, o interface{}) error Update(ctx *Context, o interface{}) error Delete(ctx *Context, o interface{}) error Search(o interface{}, q *Query) (error, Result) Get(o interface{}) (bool, error) GetBy(field string, value interface{}, o interface{}) (error, Result) Count(o interface{}, query interface{}) (int64, error) GroupBy(o interface{}, selectField, groupField string, haveQuery string, haveValue interface{}) (error, map[string]interface{}) DeleteBy(o interface{}, query interface{}) error UpdateBy(o interface{}, query interface{}) error }
type ORMObjectBase ¶
type ORMObjectBase struct { ID string `config:"id" json:"id,omitempty" protected:"true" elastic_meta:"_id" elastic_mapping:"id: { type: keyword }"` Created *time.Time `json:"created,omitempty" elastic_mapping:"created: { type: date }"` Updated *time.Time `json:"updated,omitempty" elastic_mapping:"updated: { type: date }"` }
func (*ORMObjectBase) GetID ¶
func (obj *ORMObjectBase) GetID() string
func (*ORMObjectBase) SetID ¶
func (obj *ORMObjectBase) SetID(ID string)
type ProtectedFilterKeyType ¶
type ProtectedFilterKeyType string
const ProtectedFilterKey ProtectedFilterKeyType = "FILTER_PROTECTED"
type Query ¶
type QueryType ¶
type QueryType string
const Match QueryType = "match"
const Prefix QueryType = "prefix"
const RangeGt QueryType = "gt"
const RangeGte QueryType = "gte"
const RangeLt QueryType = "lt"
const RangeLte QueryType = "lte"
const Regexp QueryType = "regexp" //TODO check
const StringTerms QueryType = "string_terms"
const Term QueryType = "term"
const Terms QueryType = "terms"
const Wildcard QueryType = "wildcard"
type TemplatedQuery ¶
Click to show internal directories.
Click to hide internal directories.