Documentation
¶
Index ¶
- Constants
- Variables
- func ConvertFromInterfaceSlice(from []interface{}, to interface{}) interface{}
- func ConvertToInterfaceSlice(from interface{}) []interface{}
- func GetConn(ctx context.Context) net.Conn
- func GetDecoder(ctx context.Context) *msgpack.Decoder
- func GetEncoder(ctx context.Context) *msgpack.Encoder
- func RegisterType(id int8, v interface{})
- type CallResult
- type Client
- type Handler
- type Server
Constants ¶
View Source
const ( Version = 0.4 MinVersion = 0.3 ErrClientVersionTooLow = "client version too low" ErrInvalidKey = "invalid key" ErrNotFound = "endpoint not found" )
Variables ¶
View Source
var ( ConnKey = ctxKey{0} EncoderKey = ctxKey{1} DecoderKey = ctxKey{2} )
Functions ¶
func ConvertFromInterfaceSlice ¶
func ConvertFromInterfaceSlice(from []interface{}, to interface{}) interface{}
ConvertFromInterfaceSlice is a helper function to convert from an `[]interface{}` slice to a typed slice. Example:
v := ConvertFromInterfaceSlice([]interface{}{1.1, 1.2, 1.3}, []float64(nil)).([]float64)
func ConvertToInterfaceSlice ¶
func ConvertToInterfaceSlice(from interface{}) []interface{}
ConvertToInterfaceSlice is a helper function to convert a typed slice to []interface{}{} Example:
v := ConvertToInterfaceSlice([]float64{1.1, 1.2, 1.3})
func RegisterType ¶
func RegisterType(id int8, v interface{})
RegisterType is an alias for msgpack.RegisterExt allows you to send and receive structs, the id must be the same on both the client and server
Types ¶
type CallResult ¶
type CallResult struct { Ret []interface{} Err error }
type Client ¶
type Client struct { MaxRetries int // contains filtered or unexported fields }
type Server ¶
type Server struct { Logger interface { Output(int, string) error } AuthFn func(key string) bool NotFoundHandler func(ctx context.Context, endpoint string, args ...interface{}) ([]interface{}, error) // contains filtered or unexported fields }
func NewWithContext ¶
func (*Server) ListenAndServe ¶
func (*Server) ListenAndServeTLS ¶
Click to show internal directories.
Click to hide internal directories.