Documentation
¶
Index ¶
- Variables
- func Alias(name string, alias string)
- func Register(name string, handler Handler)
- func RegisterGroup(name string, group map[string]Handler)
- type Handler
- type Process
- func (process *Process) ArgsArray(index int) []interface{}
- func (process *Process) ArgsBool(i int, defaults ...bool) bool
- func (process *Process) ArgsInt(i int, defaults ...int) int
- func (process *Process) ArgsMap(i int, defaults ...maps.MapStrAny) maps.MapStrAny
- func (process *Process) ArgsNotNull(i int)
- func (process *Process) ArgsQueryParams(i int, defaults ...types.QueryParam) types.QueryParam
- func (process *Process) ArgsRecords(index int) []map[string]interface{}
- func (process *Process) ArgsString(i int, defaults ...string) string
- func (process *Process) ArgsStrings(index int) []string
- func (process *Process) ArgsURLValue(i int, name string, defaults ...string) string
- func (process *Process) ArgsUint32(i int, defaults ...uint32) uint32
- func (process *Process) Dispose()
- func (process *Process) Exec() (value interface{}, err error)
- func (process *Process) Execute() (err error)
- func (process *Process) NumOfArgs() int
- func (process *Process) NumOfArgsIs(num int) bool
- func (process *Process) Release()
- func (process *Process) Run() interface{}
- func (process *Process) ValidateArgNums(length int)
- func (process *Process) Value() interface{}
- func (process *Process) WithContext(ctx context.Context) *Process
- func (process *Process) WithGlobal(global map[string]interface{}) *Process
- func (process *Process) WithRuntime(runtime Runtime) *Process
- func (process *Process) WithSID(sid string) *Process
- type Runtime
Constants ¶
This section is empty.
Variables ¶
var Handlers = map[string]Handler{}
Handlers ProcessHanlders
Functions ¶
func RegisterGroup ¶
RegisterGroup register a process handler group
Types ¶
type Process ¶
type Process struct {
Name string
Group string
Method string
Handler string
ID string
Args []interface{}
Global map[string]interface{} // Global vars
Sid string // Session ID
Context context.Context // Context
Runtime Runtime // Runtime
// contains filtered or unexported fields
}
Process the process sturct
func (*Process) ArgsNotNull ¶
ArgsNotNull parameters should be not null
func (*Process) ArgsQueryParams ¶
func (process *Process) ArgsQueryParams(i int, defaults ...types.QueryParam) types.QueryParam
ArgsQueryParams 读取参数 QueryParam
func (*Process) ArgsRecords ¶
ArgsRecords 读取 []map[string]interface{} 参数值
func (*Process) ArgsString ¶
ArgsString 读取参数 String
func (*Process) ArgsStrings ¶
ArgsStrings 读取 []string 参数值
func (*Process) ArgsURLValue ¶
ArgsURLValue 读取参数
func (*Process) ArgsUint32 ¶
ArgsUint32 get Uint32
func (*Process) Dispose ¶ added in v1.0.0
func (process *Process) Dispose()
Dispose the process after run success
func (*Process) Exec ¶
Exec execute the process and return error
****
This function causes a memory leak, will be disposed in the future, Use Execute() instead Example:
process := Of("models.user.pet.Find", 1, {})
err := process.Execute();
if err != nil {
// handle error
}
defer process.Release() // or process.Dispose() if you want to relese the runtime isolate after run success
result := process.Value() // Get the result
****
func (*Process) NumOfArgsIs ¶
NumOfArgsIs check if the number of parameters is the given value
func (*Process) Release ¶ added in v1.0.0
func (process *Process) Release()
Release the value of the process
func (*Process) Run ¶
func (process *Process) Run() interface{}
Run the process ****
This function causes a memory leak, will be disposed in the future, Use Execute() instead
****
func (*Process) ValidateArgNums ¶
ValidateArgNums Validate the parameters numbers
func (*Process) Value ¶ added in v1.0.0
func (process *Process) Value() interface{}
Value get the result of the process
func (*Process) WithContext ¶ added in v1.0.0
WithContext set the context
func (*Process) WithGlobal ¶
WithGlobal set the global vars
func (*Process) WithRuntime ¶ added in v1.0.0
WithRuntime set the runtime interface