Documentation ¶
Index ¶
- Variables
- type Client
- type InitChecker
- type OnRequest
- type ParamChecker
- func (pc *ParamChecker) Require(function string, isIn bool, name string, typeSample interface{})
- func (pc *ParamChecker) RequireIF(function string, isIn bool, name string)
- func (pc *ParamChecker) VerifyIn(function string, in Request) error
- func (pc *ParamChecker) VerifyOut(function string, out *Reply, fuzzyNumSlice bool) error
- type Proxy
- type Reply
- type Request
- type RpcType
- type Server
- type Svr
Constants ¶
This section is empty.
Variables ¶
var ( In = true Out = false TypeBool = true TypeString = "" TypeStringSlice = []string{""} TypeByteSlice = []byte("") TypeIF = gany.UnInitIF TypeIFSlice []interface{} StringSlice []string )
var ( RpcTypeGOB = RpcType("gob") RpcTypeJSON = RpcType("json") RpcTypeHPROSE = RpcType("hprose") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
type InitChecker ¶
type InitChecker func() ParamChecker
type ParamChecker ¶
type ParamChecker struct { InRequirements map[string]map[string]interface{} OutRequirements map[string]map[string]interface{} }
func NewParamChecker ¶
func NewParamChecker() *ParamChecker
func (*ParamChecker) Require ¶
func (pc *ParamChecker) Require(function string, isIn bool, name string, typeSample interface{})
Require param with specified type. Type of initialized interface{} like interface{}(”) is string, not interface{}. Type of uninitialized interface{} is 'nil'. If requires uninitialized interface{} type to allow multiple param types, set typeSample as 'nil',
func (*ParamChecker) RequireIF ¶
func (pc *ParamChecker) RequireIF(function string, isIn bool, name string)
Require interface{} param. 'nil' means uninitialized interface{} param, interface{} type param doesn't need to check type.
func (*ParamChecker) VerifyOut ¶
func (pc *ParamChecker) VerifyOut(function string, out *Reply, fuzzyNumSlice bool) error
If set 'fuzzyNumSlice' true, consider []uint8 / []uint16 ... []int64 as []float64 because after json.Unmarshal([]byte, &interface{}), output interface is set as map[string]interface{}, and any type number map value is float64 type.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
func NewProxy ¶
func NewProxy(clientRpcType RpcType, clientNetwork, clientAddress string, serverRpcType RpcType, serverNetwork, serverAddress string) (*Proxy, error)
build new proxy
func (*Proxy) AddAllowFunc ¶
func (*Proxy) AddCacheFunc ¶
Add function names which need to cache.
type Request ¶
func NewRequest ¶
func NewRequest() Request