Versions in this module Expand all Collapse all v0 v0.0.0 Apr 4, 2019 Changes in this version + const HeaderContentType + const HeaderFunction + const HeaderStatus + const HeaderUUID + const StatusHandlerError + const StatusInternalError + const StatusInternalPanic + const StatusMarshalError + const StatusOk + const StatusUnmarshalError + func RegisterSerializer(serializer Serializer) + type CallTransporter interface + Call func(ctx context.Context, function string, requestData []byte) (response []byte, err error) + type Client struct + func NewClient(t CallTransporter) Client + func (c *Client) Call(function string, requestData interface{}, responseData interface{}, ...) error + func (c *Client) Request(function string) *RPC + func (c *Client) WithMiddleware(middleware ...Middleware) + func (c *Client) WithProtocolSerializer(serializer Serializer) + func (c *Client) WithSerializer(serializer Serializer) + type ListenTransporter interface + Close func() error + Listen func(function string, ...) error + type Middleware func(request *Msg, response *Msg, next NextMiddleware) error + type Msg struct + Content []byte + Headers map[string]interface{} + func (m *Msg) BindContent(content interface{}) (err error) + func (m *Msg) ContentType() (contentType string, ok bool) + func (m *Msg) Context() context.Context + func (m *Msg) Function() (status string, ok bool) + func (m *Msg) InternalError() *Msg + func (m *Msg) Ok() *Msg + func (m *Msg) Param(key string) *Param + func (m *Msg) SetBinaryContent(content []byte) *Msg + func (m *Msg) SetContent(content interface{}) *Msg + func (m *Msg) SetContentType(contentType string) *Msg + func (m *Msg) SetContentUsing(content interface{}, serializer Serializer) *Msg + func (m *Msg) SetHeader(key string, value interface{}) *Msg + func (m *Msg) SetParam(key string, value interface{}) *Msg + func (m *Msg) SetParams(params ...Param) *Msg + func (m *Msg) SetStatus(code int) *Msg + func (m *Msg) Status() (status int, ok bool) + func (m *Msg) UUID() (status string, ok bool) + func (m *Msg) WithContext(ctx context.Context) *Msg + type NextMiddleware func() error + type Param struct + func NewParam(key string, value interface{}) Param + func (m *Param) Bool() (bool, bool) + func (m *Param) BoolOr(def bool) bool + func (m *Param) BoolSlice() ([]bool, bool) + func (m *Param) BoolSliceOr(def []bool) []bool + func (m *Param) Float() (float64, bool) + func (m *Param) FloatOr(def float64) float64 + func (m *Param) FloatSlice() ([]float64, bool) + func (m *Param) FloatSliceOr(def []float64) []float64 + func (m *Param) Int() (int64, bool) + func (m *Param) IntOr(def int64) int64 + func (m *Param) IntSlice() ([]int64, bool) + func (m *Param) IntSliceOr(def []int64) []int64 + func (m *Param) IsNil() bool + func (m *Param) IsSlice() bool + func (m *Param) Key() string + func (m *Param) String() (string, bool) + func (m *Param) StringOr(defaultTo string) string + func (m *Param) StringSlice() ([]string, bool) + func (m *Param) StringSliceOr(defaultTo []string) []string + func (m *Param) Uint() (uint64, bool) + func (m *Param) UintOr(def uint64) uint64 + func (m *Param) UintSlice() ([]uint64, bool) + func (m *Param) UintSliceOr(def []uint64) []uint64 + func (m *Param) Value() interface{} + type RPC struct + func (r *RPC) Async() *RPCTransit + func (r *RPC) BindResponseContent(content interface{}) *RPC + func (r *RPC) Callbacks(msgCallback func(*Msg), errorCallback func(error)) *RPCTransit + func (r *RPC) Channels() (<-chan *Msg, <-chan error) + func (r *RPC) Done() error + func (r *RPC) Error() error + func (r *RPC) Get() (*Msg, error) + func (r *RPC) WithBinaryContent(data []byte) *RPC + func (r *RPC) WithContent(requestData interface{}) *RPC + func (r *RPC) WithContentUsing(requestData interface{}, serializer Serializer) *RPC + func (r *RPC) WithContext(ctx context.Context) *RPC + func (r *RPC) WithMiddleware(middleware ...Middleware) *RPC + func (r *RPC) WithParam(key string, value interface{}) *RPC + func (r *RPC) WithParams(params ...Param) *RPC + func (r *RPC) WithUUID(uuid string) *RPC + type RPCError struct + Msg string + Status int + func NewRPCError(status int, msg string) RPCError + func (e RPCError) Error() string + type RPCTransit struct + func (r *RPCTransit) Callbacks(callback func(*Msg), errorCallback func(error)) *RPCTransit + func (r *RPCTransit) Channels() (<-chan *Msg, <-chan error) + func (r *RPCTransit) Done() error + func (r *RPCTransit) Error() error + func (r *RPCTransit) Get() (*Msg, error) + type Serializer struct + ContentType string + Marshal func(v interface{}) ([]byte, error) + Unmarshal func(data []byte, v interface{}) error + type Server struct + func NewServer(t ListenTransporter, namespace ...string) Server + func (s *Server) Handle(function string, handler func(request *Msg, response *Msg) error, ...) + func (s *Server) HandleFunc(handler func(request *Msg, response *Msg) error, middleware ...Middleware) + func (s *Server) WithMiddleware(middleware ...Middleware) + func (s *Server) WithProtocolSerializer(serializer Serializer) + func (s *Server) WithSerializer(serializer Serializer) + type Transporter interface