Documentation
¶
Index ¶
- Constants
- Variables
- func IdsToPrimitiveObjectIds(ids []string) []primitive.ObjectID
- func IsAggregationType(tpe Type) bool
- func IsArrayType(tpe Type) bool
- func IsBoolType(tpe Type) bool
- func IsDateTimeType(tpe Type) bool
- func IsExpandType(tpe Type) bool
- func IsFloatType(tpe Type) bool
- func IsFormulaType(tpe Type) bool
- func IsIntType(tpe Type) bool
- func IsObjectIDType(tpe Type) bool
- func IsRelateType(tpe Type) bool
- func IsStringType(tpe Type) bool
- func IsUnknownType(tpe Type) bool
- func ObjectIdFromHex(id string) primitive.ObjectID
- func StringArrayToProjection(arr []string) bson.M
- func Strings2GraphqlFieldQuery(arr []string) string
- func VarsToAnys(arr []*Var) []any
- type A
- type AggregateArgs
- type AggregateOptions
- type AggregationKind
- type AggregationType
- type AnyType
- type ArrayType
- type BoolType
- type Command
- type CountArgs
- type CountOptions
- type DateTimeType
- type DateType
- type DeleteAfterExHandler
- type DeleteAfterHandler
- type DeleteArgs
- type DeleteBeforeExHandler
- type DeleteBeforeHandler
- type DeleteByIdArgs
- type DeleteByIdOptions
- type DeleteOptions
- type EventPosition
- type ExpandType
- type ExpandsType
- type Field
- type FieldReqireCheckHandle
- type FieldUpdateableHandle
- type FieldValidateHandle
- type FindListArgs
- type FindListOptions
- type FindOneArgs
- type FindOneByIdArgs
- type FindOneByIdOptions
- type FindOneOptions
- type FloatType
- type FormulaType
- type Handle
- type IndexChangeHandler
- type IndexMoveAfterHandler
- type IndexMoveBeforeHandler
- type IndexPosition
- type InsertAfterExHandler
- type InsertAfterHandler
- type InsertArgs
- type InsertBeforeHandler
- type InsertOptions
- type IntType
- type ListenChangeHandler
- type M
- type MoveArgs
- type MoveOptions
- type Object
- type ObjectFieldPermissionCheckHandler
- type ObjectHandlePermissionCheckHandler
- type ObjectIDType
- type ObjectPermissionCheckHandler
- type Objectql
- func (o *Objectql) AddFormulaFunction(name string, fun interface{})
- func (o *Objectql) AddObject(object *Object)
- func (o *Objectql) Aggregate(ctx context.Context, objectApi string, options AggregateOptions) ([]*Var, error)
- func (o *Objectql) AsyncNext(ctx context.Context, fn func(context.Context) error, keys ...string)
- func (o *Objectql) Call(ctx context.Context, objectApi string, method string, param map[string]any, ...) (*Var, error)
- func (o *Objectql) Count(ctx context.Context, objectApi string, options CountOptions) (int64, error)
- func (o *Objectql) Delete(ctx context.Context, objectApi string, filter M) error
- func (o *Objectql) DeleteById(ctx context.Context, objectApi string, id string) error
- func (o *Objectql) Do(ctx context.Context, request string) *graphql.Result
- func (o *Objectql) DoCommand(ctx context.Context, command Command) (*Var, error)
- func (o *Objectql) DoCommands(ctx context.Context, commands []Command, filter ...map[string]any) (*Var, error)
- func (o *Objectql) EndSession(ctx context.Context)
- func (o *Objectql) FindList(ctx context.Context, objectApi string, options FindListOptions) ([]*Var, error)
- func (o *Objectql) FindOne(ctx context.Context, objectApi string, options FindOneOptions) (*Var, error)
- func (o *Objectql) FindOneById(ctx context.Context, objectApi string, options FindOneByIdOptions) (*Var, error)
- func (o *Objectql) GetObject(api string) *Object
- func (o *Objectql) GetObjects() []*Object
- func (o *Objectql) InitMongodb(ctx context.Context, uri, datebase string) (err error)
- func (o *Objectql) InitObjects(ctx context.Context) error
- func (o *Objectql) Insert(ctx context.Context, objectApi string, options InsertOptions) (*Var, error)
- func (o *Objectql) IsRootPermission(ctx context.Context) bool
- func (o *Objectql) ListenChange(table string, handle *ListenChangeHandler)
- func (o *Objectql) ListenDeleteAfter(table string, fn DeleteAfterHandler)
- func (o *Objectql) ListenDeleteAfterEx(table string, handle *DeleteAfterExHandler)
- func (o *Objectql) ListenDeleteBefore(table string, fn DeleteBeforeHandler)
- func (o *Objectql) ListenDeleteBeforeEx(table string, handle *DeleteBeforeExHandler)
- func (o *Objectql) ListenIndexChange(table string, handle *IndexChangeHandler)
- func (o *Objectql) ListenIndexMoveAfter(table string, handle *IndexMoveAfterHandler)
- func (o *Objectql) ListenIndexMoveBefore(table string, handle *IndexMoveBeforeHandler)
- func (o *Objectql) ListenInsertAfter(table string, fn InsertAfterHandler)
- func (o *Objectql) ListenInsertAfterEx(table string, handle *InsertAfterExHandler)
- func (o *Objectql) ListenInsertBefore(table string, fn InsertBeforeHandler)
- func (o *Objectql) ListenUpdateAfter(table string, fn UpdateAfterHandler)
- func (o *Objectql) ListenUpdateAfterEx(table string, handle *UpdateAfterExHandler)
- func (o *Objectql) ListenUpdateBefore(table string, fn UpdateBeoferHandler)
- func (o *Objectql) ListenUpdateBeforeEx(table string, handle *UpdateBeforeExHandler)
- func (o *Objectql) Move(ctx context.Context, objectApi string, options MoveOptions) error
- func (o *Objectql) MustGetObject(api string) (*Object, error)
- func (o *Objectql) Mutation(ctx context.Context, objectApi string, method string, param map[string]any, ...) (*Var, error)
- func (o *Objectql) Next(ctx context.Context, fn func(context.Context) error, keys ...string)
- func (o *Objectql) Query(ctx context.Context, objectApi string, method string, param map[string]any, ...) (*Var, error)
- func (o *Objectql) RemoveRootPermission(ctx context.Context) context.Context
- func (o *Objectql) Save(ctx context.Context, objectApi string, options SaveOptions) (*Var, error)
- func (o *Objectql) SetObjectFieldPermissionCheckHandler(fn ObjectFieldPermissionCheckHandler)
- func (o *Objectql) SetObjectHandlePermissionCheckHandler(fn ObjectHandlePermissionCheckHandler)
- func (o *Objectql) SetObjectPermissionCheckHandler(fn ObjectPermissionCheckHandler)
- func (o *Objectql) UnListenChange(table string, handle *ListenChangeHandler)
- func (o *Objectql) UnListenDeleteAfter(table string, fn DeleteAfterHandler)
- func (o *Objectql) UnListenDeleteAfterEx(table string, handle *DeleteAfterExHandler)
- func (o *Objectql) UnListenDeleteBefore(table string, fn DeleteBeforeHandler)
- func (o *Objectql) UnListenDeleteBeforeEx(table string, handle *DeleteBeforeExHandler)
- func (o *Objectql) UnListenIndexChange(table string, handle *IndexChangeHandler)
- func (o *Objectql) UnListenIndexMoveAfter(table string, handle *IndexMoveAfterHandler)
- func (o *Objectql) UnListenIndexMoveBefore(table string, handle *IndexMoveBeforeHandler)
- func (o *Objectql) UnListenInsertAfter(table string, fn InsertAfterHandler)
- func (o *Objectql) UnListenInsertAfterEx(table string, handle *InsertAfterExHandler)
- func (o *Objectql) UnListenInsertBefore(table string, fn InsertBeforeHandler)
- func (o *Objectql) UnListenUpdateAfter(table string, fn UpdateAfterHandler)
- func (o *Objectql) UnListenUpdateAfterEx(table string, handle *UpdateAfterExHandler)
- func (o *Objectql) UnListenUpdateBefore(table string, fn UpdateBeoferHandler)
- func (o *Objectql) UnListenUpdateBeforeEx(table string, handle *UpdateBeforeExHandler)
- func (o *Objectql) Update(ctx context.Context, objectApi string, options UpdateOptions) ([]*Var, error)
- func (o *Objectql) UpdateById(ctx context.Context, objectApi string, options UpdateByIdOptions) (*Var, error)
- func (o *Objectql) WithRootPermission(ctx context.Context) context.Context
- func (o *Objectql) WithTransaction(ctx context.Context, fn func(ctx context.Context) (interface{}, error)) (interface{}, error)
- type ObjectqlOptiosn
- type PermissionKind
- type RelateType
- type SaveArgs
- type SaveOptions
- type SelectOption
- type SelectValueFrom
- type StringType
- type TimeType
- type Type
- type UnknownType
- type UpdateAfterExHandler
- type UpdateAfterHandler
- type UpdateArgs
- type UpdateBeforeExHandler
- type UpdateBeoferHandler
- type UpdateByIdArgs
- type UpdateByIdOptions
- type UpdateOptions
- type Var
- func (e *Var) Any(n string) any
- func (e *Var) Bool(n string) bool
- func (e *Var) Float32(n string) float32
- func (e *Var) Float32s(n string) []float32
- func (e *Var) Float64(n string) float64
- func (e *Var) Float64s(n string) []float64
- func (e *Var) GTime(n string) *gtime.Time
- func (e *Var) HasKey(ns ...string) bool
- func (e *Var) HasSomeKey(ns ...string) bool
- func (e *Var) Int(n string) int
- func (e *Var) Ints(n string) []int
- func (e *Var) IsNil() bool
- func (e *Var) IsNull(ns ...string) bool
- func (e *Var) NotNull(ns ...string) bool
- func (e *Var) PtrBool(n string) *bool
- func (e *Var) PtrFloat32(n string) *float32
- func (e *Var) PtrFloat64(n string) *float64
- func (e *Var) PtrString(n string) *string
- func (e *Var) Set(k string, v any)
- func (e *Var) String(n string) string
- func (e *Var) Strings(n string) []string
- func (e *Var) Time(n string) time.Time
- func (e *Var) ToAny() any
- func (e *Var) ToBool() bool
- func (e *Var) ToFloat32() float32
- func (e *Var) ToFloat32s() []float32
- func (e *Var) ToFloat64() float64
- func (e *Var) ToFloat64s() []float64
- func (e *Var) ToInt() int
- func (e *Var) ToInts() []int
- func (e *Var) ToStrAnyMap() map[string]any
- func (e *Var) ToString() string
- func (e *Var) ToStrings() []string
- func (e *Var) ToTime() time.Time
- func (e *Var) Var(n string) *Var
- func (e *Var) Vars(n string) []*Var
Constants ¶
View Source
const MogSessionKey = "mgo_session"
Variables ¶
View Source
var Any = &AnyType{}
View Source
var Bool = &BoolType{}
View Source
var Date = &DateType{}
View Source
var DateTime = &DateTimeType{}
View Source
var (
ErrNotFoundObject = errors.New("not found object")
)
View Source
var Float = &FloatType{}
View Source
var Int = &IntType{}
View Source
var ObjectID = &ObjectIDType{}
View Source
var String = &StringType{}
View Source
var Time = &TimeType{}
Functions ¶
func IdsToPrimitiveObjectIds ¶
func IsAggregationType ¶
func IsArrayType ¶
func IsBoolType ¶
func IsDateTimeType ¶
func IsExpandType ¶
func IsFloatType ¶
func IsFormulaType ¶
func IsObjectIDType ¶
func IsRelateType ¶
func IsStringType ¶
func IsUnknownType ¶
func ObjectIdFromHex ¶
func StringArrayToProjection ¶
func VarsToAnys ¶
Types ¶
type AggregateArgs ¶
type AggregateOptions ¶
type AggregationKind ¶
type AggregationKind = int
const ( Sum AggregationKind = iota Max Min Avg Count )
type AggregationType ¶
type Command ¶
type Command struct {
Call string `json:"call"`
Args any `json:"args"`
Fields []string `json:"fields"`
Result string `json:"result"`
}
COMMAND
type CountOptions ¶
type DateTimeType ¶
type DateTimeType struct{}
type DeleteAfterExHandler ¶
type DeleteArgs ¶
type DeleteBeforeExHandler ¶
type DeleteByIdArgs ¶
type DeleteByIdArgs struct {
ID string `json:"id"`
}
type DeleteByIdOptions ¶
type DeleteByIdOptions struct {
ID string `json:"id"`
}
type DeleteOptions ¶
type EventPosition ¶
type EventPosition int
const ( InsertBefore EventPosition = 1 << iota InsertAfter UpdateBefore UpdateAfter DeleteBefore DeleteAfter IndexMoveBefore IndexMoveAfter InsertFull EventPosition = InsertBefore | InsertAfter UpdateFull EventPosition = UpdateBefore | UpdateAfter DeleteFull EventPosition = DeleteBefore | DeleteAfter MoveFull EventPosition = IndexMoveBefore | IndexMoveAfter ChangeBefores EventPosition = InsertBefore | UpdateBefore | DeleteBefore ChangeAfters EventPosition = InsertAfter | UpdateAfter | DeleteAfter )
type ExpandType ¶
type ExpandsType ¶
type Field ¶
type Field struct {
Parent *Object
Primary bool
Require any
RequireMsg string
Validate any
ValidateMsg string
Updateable any
UpdateableMsg string
DeleteSync bool
Type Type
Name string
Api string
Comment string
Default any
Select []SelectOption
SelectFrom *SelectValueFrom
SelectLabel string
Fields []string // resolve 依赖的字段
Resolve func(map[string]any) (interface{}, error)
// contains filtered or unexported fields
}
func (*Field) HasRelation ¶
type FieldReqireCheckHandle ¶
type FieldUpdateableHandle ¶
type FieldValidateHandle ¶
type FindListArgs ¶
type FindListOptions ¶
type FindOneArgs ¶
type FindOneByIdArgs ¶
type FindOneByIdArgs struct {
ID string `json:"id"`
}
type FindOneByIdOptions ¶
type FindOneOptions ¶
type FormulaType ¶
func NewFormula ¶
func NewFormula(tpe Type, formula string) *FormulaType
type IndexChangeHandler ¶
type IndexMoveAfterHandler ¶
type IndexMoveBeforeHandler ¶
type IndexPosition ¶
type InsertAfterExHandler ¶
type InsertAfterExHandler struct {
Fields []string
Handle func(ctx context.Context, id string, doc *Var, cur *Var) error
}
EX
type InsertAfterHandler ¶
type InsertArgs ¶
type InsertOptions ¶
type ListenChangeHandler ¶
type M ¶
func IdStrings2ConvMaps ¶
type MoveOptions ¶
type ObjectIDType ¶
type ObjectIDType struct{}
type Objectql ¶
type Objectql struct {
// contains filtered or unexported fields
}
func New ¶
func New(optinos ...ObjectqlOptiosn) *Objectql
func (*Objectql) AddFormulaFunction ¶
func (*Objectql) Call ¶
func (o *Objectql) Call(ctx context.Context, objectApi string, method string, param map[string]any, fields ...[]string) (*Var, error)
调用用户定义的query和mutation
func (*Objectql) DeleteById ¶
func (*Objectql) DoCommands ¶
func (*Objectql) EndSession ¶
func (*Objectql) FindOneById ¶
func (*Objectql) GetObjects ¶
func (*Objectql) InitMongodb ¶
func (*Objectql) Insert ¶
func (o *Objectql) Insert(ctx context.Context, objectApi string, options InsertOptions) (*Var, error)
增删改查接口
func (*Objectql) ListenChange ¶
func (o *Objectql) ListenChange(table string, handle *ListenChangeHandler)
func (*Objectql) ListenDeleteAfter ¶
func (o *Objectql) ListenDeleteAfter(table string, fn DeleteAfterHandler)
func (*Objectql) ListenDeleteAfterEx ¶
func (o *Objectql) ListenDeleteAfterEx(table string, handle *DeleteAfterExHandler)
func (*Objectql) ListenDeleteBefore ¶
func (o *Objectql) ListenDeleteBefore(table string, fn DeleteBeforeHandler)
func (*Objectql) ListenDeleteBeforeEx ¶
func (o *Objectql) ListenDeleteBeforeEx(table string, handle *DeleteBeforeExHandler)
func (*Objectql) ListenIndexChange ¶
func (o *Objectql) ListenIndexChange(table string, handle *IndexChangeHandler)
func (*Objectql) ListenIndexMoveAfter ¶
func (o *Objectql) ListenIndexMoveAfter(table string, handle *IndexMoveAfterHandler)
func (*Objectql) ListenIndexMoveBefore ¶
func (o *Objectql) ListenIndexMoveBefore(table string, handle *IndexMoveBeforeHandler)
func (*Objectql) ListenInsertAfter ¶
func (o *Objectql) ListenInsertAfter(table string, fn InsertAfterHandler)
func (*Objectql) ListenInsertAfterEx ¶
func (o *Objectql) ListenInsertAfterEx(table string, handle *InsertAfterExHandler)
func (*Objectql) ListenInsertBefore ¶
func (o *Objectql) ListenInsertBefore(table string, fn InsertBeforeHandler)
func (*Objectql) ListenUpdateAfter ¶
func (o *Objectql) ListenUpdateAfter(table string, fn UpdateAfterHandler)
func (*Objectql) ListenUpdateAfterEx ¶
func (o *Objectql) ListenUpdateAfterEx(table string, handle *UpdateAfterExHandler)
func (*Objectql) ListenUpdateBefore ¶
func (o *Objectql) ListenUpdateBefore(table string, fn UpdateBeoferHandler)
func (*Objectql) ListenUpdateBeforeEx ¶
func (o *Objectql) ListenUpdateBeforeEx(table string, handle *UpdateBeforeExHandler)
func (*Objectql) RemoveRootPermission ¶
func (*Objectql) SetObjectFieldPermissionCheckHandler ¶
func (o *Objectql) SetObjectFieldPermissionCheckHandler(fn ObjectFieldPermissionCheckHandler)
func (*Objectql) SetObjectHandlePermissionCheckHandler ¶
func (o *Objectql) SetObjectHandlePermissionCheckHandler(fn ObjectHandlePermissionCheckHandler)
func (*Objectql) SetObjectPermissionCheckHandler ¶
func (o *Objectql) SetObjectPermissionCheckHandler(fn ObjectPermissionCheckHandler)
func (*Objectql) UnListenChange ¶
func (o *Objectql) UnListenChange(table string, handle *ListenChangeHandler)
func (*Objectql) UnListenDeleteAfter ¶
func (o *Objectql) UnListenDeleteAfter(table string, fn DeleteAfterHandler)
func (*Objectql) UnListenDeleteAfterEx ¶
func (o *Objectql) UnListenDeleteAfterEx(table string, handle *DeleteAfterExHandler)
func (*Objectql) UnListenDeleteBefore ¶
func (o *Objectql) UnListenDeleteBefore(table string, fn DeleteBeforeHandler)
func (*Objectql) UnListenDeleteBeforeEx ¶
func (o *Objectql) UnListenDeleteBeforeEx(table string, handle *DeleteBeforeExHandler)
func (*Objectql) UnListenIndexChange ¶
func (o *Objectql) UnListenIndexChange(table string, handle *IndexChangeHandler)
func (*Objectql) UnListenIndexMoveAfter ¶
func (o *Objectql) UnListenIndexMoveAfter(table string, handle *IndexMoveAfterHandler)
func (*Objectql) UnListenIndexMoveBefore ¶
func (o *Objectql) UnListenIndexMoveBefore(table string, handle *IndexMoveBeforeHandler)
func (*Objectql) UnListenInsertAfter ¶
func (o *Objectql) UnListenInsertAfter(table string, fn InsertAfterHandler)
func (*Objectql) UnListenInsertAfterEx ¶
func (o *Objectql) UnListenInsertAfterEx(table string, handle *InsertAfterExHandler)
func (*Objectql) UnListenInsertBefore ¶
func (o *Objectql) UnListenInsertBefore(table string, fn InsertBeforeHandler)
func (*Objectql) UnListenUpdateAfter ¶
func (o *Objectql) UnListenUpdateAfter(table string, fn UpdateAfterHandler)
func (*Objectql) UnListenUpdateAfterEx ¶
func (o *Objectql) UnListenUpdateAfterEx(table string, handle *UpdateAfterExHandler)
func (*Objectql) UnListenUpdateBefore ¶
func (o *Objectql) UnListenUpdateBefore(table string, fn UpdateBeoferHandler)
func (*Objectql) UnListenUpdateBeforeEx ¶
func (o *Objectql) UnListenUpdateBeforeEx(table string, handle *UpdateBeforeExHandler)
func (*Objectql) UpdateById ¶
func (*Objectql) WithRootPermission ¶
type ObjectqlOptiosn ¶
type PermissionKind ¶
type PermissionKind int
const ( ObjectInsert PermissionKind = iota ObjectUpdate ObjectDelete ObjectQuery FieldQuery FieldUpdate )
type RelateType ¶
func NewRelate ¶
func NewRelate(api string, expandOpt ...[]string) *RelateType
type SaveOptions ¶
type SelectOption ¶
type SelectOption struct {
Label string `json:"label"`
Value interface{} `json:"value"`
}
type SelectValueFrom ¶
type StringType ¶
type StringType struct{}
type Type ¶
type Type interface {
// contains filtered or unexported methods
}
func GetExplicitType ¶
type UnknownType ¶
type UnknownType struct{}
type UpdateAfterExHandler ¶
type UpdateAfterHandler ¶
type UpdateArgs ¶
type UpdateBeforeExHandler ¶
type UpdateBeoferHandler ¶
type UpdateByIdArgs ¶
type UpdateByIdOptions ¶
type UpdateOptions ¶
type Var ¶
type Var struct {
// contains filtered or unexported fields
}
func (*Var) HasSomeKey ¶
func (*Var) PtrFloat32 ¶
func (*Var) PtrFloat64 ¶
func (*Var) ToFloat32s ¶
func (*Var) ToFloat64s ¶
func (*Var) ToStrAnyMap ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.