process

package
v0.10.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2023 License: Apache-2.0 Imports: 10 Imported by: 29

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Handlers = map[string]Handler{}

Handlers ProcessHanlders

Functions

func Alias

func Alias(name string, alias string)

Alias set an alias a process

func Register

func Register(name string, handler Handler)

Register register a process handler

func RegisterGroup

func RegisterGroup(name string, group map[string]Handler)

RegisterGroup register a process handler group

Types

type Handler

type Handler func(process *Process) interface{}

Handler the process handler

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
}

Process the process sturct

func New

func New(name string, args ...interface{}) *Process

New make a new process

func Of

func Of(name string, args ...interface{}) (*Process, error)

Of make a new process and return error

func (*Process) ArgsArray

func (process *Process) ArgsArray(index int) []interface{}

ArgsArray 读取 []interface{} 参数值

func (*Process) ArgsBool

func (process *Process) ArgsBool(i int, defaults ...bool) bool

ArgsBool 读取参数 String

func (*Process) ArgsInt

func (process *Process) ArgsInt(i int, defaults ...int) int

ArgsInt 读取参数 Int

func (*Process) ArgsMap

func (process *Process) ArgsMap(i int, defaults ...maps.MapStrAny) maps.MapStrAny

ArgsMap 读取Map 类型参数

func (*Process) ArgsNotNull

func (process *Process) ArgsNotNull(i int)

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

func (process *Process) ArgsRecords(index int) []map[string]interface{}

ArgsRecords 读取 []map[string]interface{} 参数值

func (*Process) ArgsString

func (process *Process) ArgsString(i int, defaults ...string) string

ArgsString 读取参数 String

func (*Process) ArgsStrings

func (process *Process) ArgsStrings(index int) []string

ArgsStrings 读取 []string 参数值

func (*Process) ArgsURLValue

func (process *Process) ArgsURLValue(i int, name string, defaults ...string) string

ArgsURLValue 读取参数

func (*Process) ArgsUint32

func (process *Process) ArgsUint32(i int, defaults ...uint32) uint32

ArgsUint32 get Uint32

func (*Process) Exec

func (process *Process) Exec() (value interface{}, err error)

Exec execute the process and return error

func (*Process) NumOfArgs

func (process *Process) NumOfArgs() int

NumOfArgs get the parameters numbers

func (*Process) NumOfArgsIs

func (process *Process) NumOfArgsIs(num int) bool

NumOfArgsIs check if the number of parameters is the given value

func (*Process) Run

func (process *Process) Run() interface{}

Run the process

func (*Process) ValidateArgNums

func (process *Process) ValidateArgNums(length int)

ValidateArgNums Validate the parameters numbers

func (*Process) WithGlobal

func (process *Process) WithGlobal(global map[string]interface{}) *Process

WithGlobal set the global vars

func (*Process) WithSID

func (process *Process) WithSID(sid string) *Process

WithSID set the session id

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL