Documentation
¶
Index ¶
- Constants
- type BulkParse
- type ConnectionOpTree
- type CountParse
- type DeleteParse
- type FindParse
- type InsertParse
- type InterfaceOperation
- type OperateMode
- type Operation
- type Order
- type Query
- type QueryComparator
- type QueryConnectionOp
- type QueryMode
- type TransactionOperation
- type TransactionParse
- type UpdateField
- type UpdateParse
Constants ¶
View Source
const ( Insert = "Insert" Find = "Find" Update = "Update" Delete = "Delete" Count = "Count" Transaction = "Transaction" Bulk = "Bulk" )
View Source
const ( OperateOne = OperateMode(0) OperateMany = OperateMode(1) )
View Source
const ( One = "One" Many = "Many" )
View Source
const ( By = QueryMode("By") All = QueryMode("All") )
View Source
const ( And = QueryConnectionOp("And") Or = QueryConnectionOp("Or") )
View Source
const ( Equal = QueryComparator("Equal") NotEqual = QueryComparator("NotEqual") LessThan = QueryComparator("LessThan") LessThanEqual = QueryComparator("LessThanEqual") GreaterThan = QueryComparator("GreaterThan") GreaterThanEqual = QueryComparator("GreaterThanEqual") Between = QueryComparator("Between") NotBetween = QueryComparator("NotBetween") In = QueryComparator("In") NotIn = QueryComparator("NotIn") True = QueryComparator("True") False = QueryComparator("False") Exists = QueryComparator("Exists") NotExists = QueryComparator("NotExists") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BulkParse ¶
type BulkParse struct {
// Operations defines all the operations contained in the Bulk,
// supports Insert One(Many not support), Update One Many, Delete One Many
Operations []Operation
// CtxParamName defines the method's context.Context param name when Bulk is called independently
CtxParamName string
// BelongedToMethod defines the method to which Bulk belongs
BelongedToMethod *extract.InterfaceMethod
}
func (*BulkParse) GetOperationName ¶
type ConnectionOpTree ¶
type ConnectionOpTree struct {
Name string // if not leaf, store And || Or, else store QueryComparator(ComparatorName)
LeftChildren *ConnectionOpTree
RightChildren *ConnectionOpTree
MongoFieldName string // if not leaf, empty
ParamNames []string // if not leaf, empty
}
type CountParse ¶
type CountParse struct {
// Query defines the Query information contained in the Count operation
Query *Query
// CtxParamName defines the method's context.Context param name
CtxParamName string
// BelongedToMethod defines the method to which Count belongs
BelongedToMethod *extract.InterfaceMethod
}
func (*CountParse) GetOperationName ¶
func (cp *CountParse) GetOperationName() string
type DeleteParse ¶
type DeleteParse struct {
// OperateMode One or Many
OperateMode OperateMode
// Query defines the Query information contained in the Delete operation
Query *Query
// CtxParamName defines the method's context.Context param name
CtxParamName string
// BelongedToMethod defines the method to which Delete belongs
BelongedToMethod *extract.InterfaceMethod
}
func (*DeleteParse) GetOperationName ¶
func (dp *DeleteParse) GetOperationName() string
type FindParse ¶
type FindParse struct {
// OperateMode One or Many
OperateMode OperateMode
// Query defines the Query information contained in the Find operation
Query *Query
Project []string
Order Order
SkipParamName string
LimitParamName string
// CtxParamName defines the method's context.Context param name
CtxParamName string
// ReturnType defines the method's first return parameter's Type which Find belongs
ReturnType code.Type
// BelongedToMethod defines the method to which Find belongs
BelongedToMethod *extract.InterfaceMethod
}
func (*FindParse) GetOperationName ¶
type InsertParse ¶
type InsertParse struct {
// OperateMode One or Many
OperateMode OperateMode
// MethodParamNames defines the method's param names
MethodParamNames [2]string
// BelongedToMethod defines the method to which Insert belongs
BelongedToMethod *extract.InterfaceMethod
}
func (*InsertParse) GetOperationName ¶
func (ip *InsertParse) GetOperationName() string
type InterfaceOperation ¶
type InterfaceOperation struct {
BelongedToStruct *extract.IdlExtractStruct
Operations []Operation
}
InterfaceOperation is used to store the parsing results of the structure and for use by codegen packages.
func HandleOperations ¶
func HandleOperations(structs []*extract.IdlExtractStruct) (result []*InterfaceOperation, err error)
type OperateMode ¶
type OperateMode int
type Query ¶
type Query struct {
// QueryMode By or All
QueryMode QueryMode
// ConnectionOpTree stores query information
ConnectionOpTree *ConnectionOpTree
}
type QueryComparator ¶
type QueryComparator string
type QueryConnectionOp ¶
type QueryConnectionOp string
type TransactionOperation ¶
type TransactionParse ¶
type TransactionParse struct {
// TransactionOperations defines all the operations contained in the Transaction,
// supports Insert One Many, Update One Many, Delete One Many, Bulk(Mark boundaries with parentheses).
TransactionOperations []TransactionOperation
// CtxParamName defines the method's context.Context param name
CtxParamName string
// ClientParamName defines the method's *mongo.Client param name
ClientParamName string
// BelongedToMethod defines the method to which Transaction belongs
BelongedToMethod *extract.InterfaceMethod
// contains filtered or unexported fields
}
func (*TransactionParse) GetOperationName ¶
func (tp *TransactionParse) GetOperationName() string
type UpdateField ¶
type UpdateParse ¶
type UpdateParse struct {
// OperateMode One or Many
OperateMode OperateMode
// UpdateStructObjName defines the method's structure point param name,
// is used when updating the entire structure.
UpdateStructObjName string
// Query defines the Query information contained in the Update operation
Query *Query
// CtxParamName defines the method's context.Context param name
CtxParamName string
// BelongedToMethod defines the method to which Update belongs
BelongedToMethod *extract.InterfaceMethod
Upsert bool
UpdateFields []UpdateField
}
func (*UpdateParse) GetOperationName ¶
func (up *UpdateParse) GetOperationName() string
Click to show internal directories.
Click to hide internal directories.