gmx

package module
v0.0.0-...-baff7a3 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: Apache-2.0 Imports: 15 Imported by: 2

README

gmx

Documentation

Index

Constants

View Source
const (
	Tag_OK                = 0
	Tag_ParamIllegal      = 1
	Tag_AuthFailed        = 2
	Tag_AuthNeed          = 3
	Tag_AccessDenied      = 4
	Tag_ProcessTimeout    = 5
	Tag_NoFindValue       = 6
	Tag_NoFindField       = 7
	Tag_MapInvalid        = 8
	Tag_NoMoreData        = 9
	Tag_SliceIsNil        = 10
	Tag_NoFindMethod      = 11
	Tag_OpDisable         = 12
	Tag_InternalException = 13
)
View Source
const (
	SESSION_AUTH_IP = "_$IP$_"
)

Variables

View Source
var SessionMgr cache.Cache

Functions

func Close

func Close() error

func DisableOp

func DisableOp()

func EnableOp

func EnableOp()

func FieldByIndexOfValue

func FieldByIndexOfValue(v reflect.Value, idx []int) reflect.Value

func FieldByNameOfValue

func FieldByNameOfValue(v reflect.Value, vname, fname string, s *Session) reflect.Value

func FieldsOfType

func FieldsOfType(t reflect.Type) []reflect.StructField

func FieldsOfValue

func FieldsOfValue(v reflect.Value) []reflect.Value

func FindValue

func FindValue(name string) reflect.Value

func FullNameOfType

func FullNameOfType(t reflect.Type) string

func FullNameOfValue

func FullNameOfValue(v reflect.Value) string

func IsRunning

func IsRunning() bool

func MethodsOfType

func MethodsOfType(t reflect.Type) []reflect.Method

func MethodsOfValue

func MethodsOfValue(v reflect.Value) []reflect.Value

func RandomString

func RandomString(n int) string

RandomString returns a random string with a fixed length

func RegisteOpHandler

func RegisteOpHandler(op string, h Handler)

func RegisteThreadSafeSandbox

func RegisteThreadSafeSandbox(sb ThreadSafeSandBox)

func RegisteType

func RegisteType(ud interface{})

func RegisteValue

func RegisteValue(name string, ud interface{})

func SetBool

func SetBool(v reflect.Value, x bool) bool

func SetBytes

func SetBytes(v reflect.Value, x []byte) bool

func SetComplex

func SetComplex(v reflect.Value, x complex128) bool

func SetDebug

func SetDebug(debug bool)

Enable the delivery of debug messages to the logger. Only meaningful if a logger is also set.

func SetFloat

func SetFloat(v reflect.Value, x float64) bool

func SetInt

func SetInt(v reflect.Value, x int64) bool

func SetLogger

func SetLogger(logger log_Logger)

Specify the *log.Logger object where log messages should be sent to.

func SetPointer

func SetPointer(v reflect.Value, x unsafe.Pointer) bool

func SetSession

func SetSession(s *Session)

func SetString

func SetString(v reflect.Value, x string) bool

func SetUint

func SetUint(v reflect.Value, x uint64) bool

func Startup

func Startup(cfg Config) error

func Types

func Types() map[string]reflect.Type

func TypesByNameFunc

func TypesByNameFunc(match func(string) bool) map[string]reflect.Type

func UnregisteValue

func UnregisteValue(name string, ud interface{})

func UnsafeSetBool

func UnsafeSetBool(v reflect.Value, x bool) bool

func UnsafeSetBytes

func UnsafeSetBytes(v reflect.Value, x []byte) bool

func UnsafeSetComplex

func UnsafeSetComplex(v reflect.Value, x complex128) bool

func UnsafeSetFloat

func UnsafeSetFloat(v reflect.Value, x float64) bool

func UnsafeSetInt

func UnsafeSetInt(v reflect.Value, x int64) bool

func UnsafeSetPointer

func UnsafeSetPointer(v reflect.Value, x uintptr) bool

func UnsafeSetString

func UnsafeSetString(v reflect.Value, x string) bool

func UnsafeSetUint

func UnsafeSetUint(v reflect.Value, x uint64) bool

func Values

func Values() map[string]reflect.Value

func ValuesByNameFunc

func ValuesByNameFunc(match func(string) bool) map[string]reflect.Value

Types

type ApiResult

type ApiResult struct {
	Tag      int
	Msg      interface{}
	UserData string
}

type Config

type Config struct {
	Addr            string   //gmx api地址
	Username        string   //gmx 交互用的用户名
	Password        string   //gmx 交互用的密码
	SessionLifeTime int      //gmx session生命周期,单位:秒
	Timeout         int      //gmx api超时时间,单位:秒
	WhiteAddr       []string //gmx api交互白名单地址
	Debug           bool     //gmx debug模式,log开关
	EnableOp        bool     //gmx api交互开关
}
var Cfg Config

func (*Config) IsValid

func (cfg *Config) IsValid() bool

type FieldTypeDesc

type FieldTypeDesc struct {
	Name       string `json:"name"`
	Type       string `json:"type"`
	Kind       uint   `json:"kind"`
	Tag        string `json:"tag"`
	Offset     int    `json:"offset"`
	Index      []int  `json:"index"`
	Anonymous  bool   `json:"anonymous"`
	IsExported bool   `json:"isexported"`
}

Class = {"name":"xxx", "type":"string"},{"name":"yyy", "type":"int"}

type FieldValueDesc

type FieldValueDesc struct {
	FieldTypeDesc
	Value interface{} `json:"value"`
}

type Handler

type Handler interface {
	Serve(*OpEvent) *ApiResult
}

func GetOpHandler

func GetOpHandler(op string) Handler

type HandlerWrapper

type HandlerWrapper func(*OpEvent) *ApiResult

func (HandlerWrapper) Serve

func (hw HandlerWrapper) Serve(event *OpEvent) *ApiResult

type InvokeResult

type InvokeResult struct {
	Name     string
	FuncName string
	RetVals  []*ValueDesc
}

type MapDesc

type MapDesc struct {
	Name         string
	Type         string
	PageNo       int
	NumOfPerPage int
	TotalCount   int
	Keys         []*ValueDesc
	Vals         []*ValueDesc
}

type MethodDesc

type MethodDesc struct {
	Name      string        `json:"name"`
	Index     int           `json:"index"`
	RcvrIsPtr bool          `json:"rcvrisptr"`
	In        []MethodParam `json:"in"`
	Out       []MethodParam `json:"out"`
}

type MethodParam

type MethodParam struct {
	Name  string `json:"name"`
	Type  string `json:"type"`
	Kind  uint   `json:"kind"`
	Index int    `json:"index"`
}

type OpEvent

type OpEvent struct {
	// contains filtered or unexported fields
}

func (*OpEvent) Done

func (oe *OpEvent) Done() error

type Session

type Session struct {
	sync.Map
	Id         string
	CreateTime time.Time
}

func GetSession

func GetSession(id string) *Session

func NewSession

func NewSession(id string) *Session

func (*Session) Get

func (s *Session) Get(key interface{}) (interface{}, bool)

func (*Session) Set

func (s *Session) Set(key, val interface{})

type SliceDesc

type SliceDesc struct {
	Name         string
	Type         string
	PageNo       int
	NumOfPerPage int
	TotalCount   int
	ElemType     string
	Elems        interface{}
}

type Test

type Test struct {
	*TestNest
	T string
}

func (Test) String

func (t Test) String()

type TestNest

type TestNest struct {
	I int

	I8 int8

	I16 int16

	I32 int32

	I64 int64

	U uint

	U8 uint8

	U16 uint16

	U32 uint32

	U64 uint64

	F32 float32

	F64 float64

	Str string
	// contains filtered or unexported fields
}

func NewTestNest

func NewTestNest() *TestNest

func (TestNest) String

func (tn TestNest) String()

type ThreadSafeSandBox

type ThreadSafeSandBox func(*OpEvent) error

线程安全沙箱,确保对注册对象的访问发生在安全沙箱里

type TypeDesc

type TypeDesc struct {
	Name       string          `json:"name"`
	Type       string          `json:"type"`
	IsExported bool            `json:"isexported"`
	Fields     []FieldTypeDesc `json:"fields"`
	Methods    []MethodDesc    `json:"methods"`
}

Classes = [{"name":"xxx", "type":"string"},{"name":"yyy", "type":"int"}]

func MetaOfType

func MetaOfType(t reflect.Type) *TypeDesc

type ValueDesc

type ValueDesc struct {
	Name    string           `json:"name"`
	Type    string           `json:"type"`
	Kind    uint             `json:"kind"`
	CanSet  bool             `json:"canset"`
	Value   interface{}      `json:"value"`
	Fields  []FieldValueDesc `json:"fields"`
	Methods []MethodDesc     `json:"methods"`
}

func DescOfValue

func DescOfValue(v reflect.Value) *ValueDesc

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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