Documentation ¶
Index ¶
- Variables
- func BytesToString(bytes []byte) string
- func ClientShouldReportError(err error, statusCode int) bool
- func FillIncomingRPCFiltersTable(rpcFiltersTable [][]IncomingRPCHandler, ...)
- func FillOutgoingRPCFiltersTable(rpcFiltersTable [][]OutgoingRPCHandler, ...)
- func HandleOutgoingRPC(ctx context.Context, outgoingRPC *OutgoingRPC) error
- func HandleRequest(request *http.Request, incomingRPC *IncomingRPC, ...)
- func MakeContextWithIncomingRPC(ctx context.Context, incomingRPC *IncomingRPC) context.Context
- func MakeInMemoryTransport(handler http.Handler) http.RoundTripper
- func ServerShouldReportError(err error, statusCode int) bool
- type ActorOptions
- type ClientOptions
- type DummyFurtherValidator
- type DummyModel
- type Error
- type ErrorCode
- type ErrorData
- type FurtherValidator
- type IncomingRPC
- func (ir *IncomingRPC) Do(ctx context.Context) (returnedErr error)
- func (ir *IncomingRPC) EncodeResults() error
- func (ir *IncomingRPC) LoadParams(ctx context.Context) error
- func (ir *IncomingRPC) ReadRawParams() error
- func (ir *IncomingRPC) SetFilters(filters []IncomingRPCHandler)
- func (ir *IncomingRPC) SetHandler(handler IncomingRPCHandler)
- func (ir *IncomingRPC) SetReader(reader io.Reader)
- type IncomingRPCHandler
- type Model
- type OutgoingRPC
- func (or *OutgoingRPC) Do(ctx context.Context) error
- func (or *OutgoingRPC) EncodeParams() error
- func (or *OutgoingRPC) LoadResults(ctx context.Context) error
- func (or *OutgoingRPC) ReadRawResults() error
- func (or *OutgoingRPC) SetFilters(filters []OutgoingRPCHandler)
- func (or *OutgoingRPC) SetHandler(handler OutgoingRPCHandler)
- func (or *OutgoingRPC) SetReadCloser(readCloser io.ReadCloser)
- type OutgoingRPCHandler
- type ReaderFunc
- type RouteInfo
- type Router
- type TraceIDGenerator
- type TransportFunc
- type ValidationContext
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidResults = errors.New("invalid results") ErrUnexpectedStatusCode = errors.New("unexpected status code") )
View Source
var DebugMode bool
Functions ¶
func BytesToString ¶ added in v0.8.0
func ClientShouldReportError ¶ added in v0.8.4
func FillIncomingRPCFiltersTable ¶ added in v0.8.0
func FillIncomingRPCFiltersTable(rpcFiltersTable [][]IncomingRPCHandler, rpcFilters map[int][]IncomingRPCHandler)
func FillOutgoingRPCFiltersTable ¶ added in v0.8.0
func FillOutgoingRPCFiltersTable(rpcFiltersTable [][]OutgoingRPCHandler, rpcFilters map[int][]OutgoingRPCHandler)
func HandleOutgoingRPC ¶ added in v0.8.0
func HandleOutgoingRPC(ctx context.Context, outgoingRPC *OutgoingRPC) error
func HandleRequest ¶ added in v0.8.0
func HandleRequest( request *http.Request, incomingRPC *IncomingRPC, traceIDGenerator TraceIDGenerator, responseWriter http.ResponseWriter, )
func MakeContextWithIncomingRPC ¶ added in v0.8.0
func MakeContextWithIncomingRPC(ctx context.Context, incomingRPC *IncomingRPC) context.Context
func MakeInMemoryTransport ¶ added in v0.8.0
func MakeInMemoryTransport(handler http.Handler) http.RoundTripper
func ServerShouldReportError ¶ added in v0.8.4
Types ¶
type ActorOptions ¶ added in v0.8.3
type ActorOptions struct { RPCFilters map[int][]IncomingRPCHandler TraceIDGenerator TraceIDGenerator }
func (*ActorOptions) AddCommonRPCFilters ¶ added in v0.8.3
func (ao *ActorOptions) AddCommonRPCFilters(rpcFilters ...IncomingRPCHandler)
func (*ActorOptions) AddRPCFilters ¶ added in v0.8.3
func (ao *ActorOptions) AddRPCFilters(methodIndex int, rpcFilters ...IncomingRPCHandler)
func (*ActorOptions) Sanitize ¶ added in v0.8.3
func (ao *ActorOptions) Sanitize()
type ClientOptions ¶
type ClientOptions struct { RPCFilters map[int][]OutgoingRPCHandler Timeout time.Duration Transport http.RoundTripper }
func (*ClientOptions) AddCommonRPCFilters ¶ added in v0.8.0
func (co *ClientOptions) AddCommonRPCFilters(rpcFilters ...OutgoingRPCHandler)
func (*ClientOptions) AddRPCFilters ¶ added in v0.8.0
func (co *ClientOptions) AddRPCFilters(methodIndex int, rpcFilters ...OutgoingRPCHandler)
func (*ClientOptions) Sanitize ¶
func (co *ClientOptions) Sanitize()
type DummyFurtherValidator ¶
type DummyFurtherValidator struct {
// contains filtered or unexported fields
}
func (DummyFurtherValidator) FurtherValidate ¶
func (DummyFurtherValidator) FurtherValidate(*ValidationContext) bool
type DummyModel ¶ added in v0.8.0
type DummyModel struct{}
func (DummyModel) Validate ¶ added in v0.8.0
func (DummyModel) Validate(*ValidationContext) bool
type Error ¶
type Error struct { Code ErrorCode `json:"-"` StatusCode int `json:"-"` Message string `json:"message"` Details string `json:"details,omitempty"` Data ErrorData `json:"data,omitempty"` }
func NewInvalidParamsError ¶
func NewInvalidParamsError() *Error
func NewNotImplementedError ¶
func NewNotImplementedError() *Error
type ErrorCode ¶
type ErrorCode int32
const ErrorInvalidParams ErrorCode = 2
const ErrorNotImplemented ErrorCode = 1
type FurtherValidator ¶
type FurtherValidator interface {
FurtherValidate(validationContext *ValidationContext) (ok bool)
}
type IncomingRPC ¶
type IncomingRPC struct { Namespace string ServiceName string MethodName string FullMethodName string MethodIndex int Params Model Results Model RemoteIP string InboundHeader http.Header OutboundHeader http.Header TraceID string RawParams []byte StatusCode int ErrorCode ErrorCode RawResults []byte // contains filtered or unexported fields }
func GetIncomingRPCFromContext ¶ added in v0.8.0
func GetIncomingRPCFromContext(ctx context.Context) (*IncomingRPC, bool)
func (*IncomingRPC) Do ¶ added in v0.8.0
func (ir *IncomingRPC) Do(ctx context.Context) (returnedErr error)
func (*IncomingRPC) EncodeResults ¶ added in v0.8.0
func (ir *IncomingRPC) EncodeResults() error
func (*IncomingRPC) LoadParams ¶ added in v0.8.0
func (ir *IncomingRPC) LoadParams(ctx context.Context) error
func (*IncomingRPC) ReadRawParams ¶ added in v0.8.0
func (ir *IncomingRPC) ReadRawParams() error
func (*IncomingRPC) SetFilters ¶ added in v0.8.0
func (ir *IncomingRPC) SetFilters(filters []IncomingRPCHandler)
func (*IncomingRPC) SetHandler ¶ added in v0.8.0
func (ir *IncomingRPC) SetHandler(handler IncomingRPCHandler)
func (*IncomingRPC) SetReader ¶ added in v0.8.0
func (ir *IncomingRPC) SetReader(reader io.Reader)
type IncomingRPCHandler ¶ added in v0.8.0
type IncomingRPCHandler func(ctx context.Context, incomingRPC *IncomingRPC) (err error)
type Model ¶
type Model interface {
Validate(validationContext *ValidationContext) (ok bool)
}
type OutgoingRPC ¶
type OutgoingRPC struct { Namespace string ServiceName string MethodName string FullMethodName string MethodIndex int Params Model Results Model Transport http.RoundTripper URL string OutboundHeader http.Header RawParams []byte StatusCode int InboundHeader http.Header TraceID string ErrorCode ErrorCode RawResults []byte // contains filtered or unexported fields }
func (*OutgoingRPC) EncodeParams ¶ added in v0.8.0
func (or *OutgoingRPC) EncodeParams() error
func (*OutgoingRPC) LoadResults ¶ added in v0.8.0
func (or *OutgoingRPC) LoadResults(ctx context.Context) error
func (*OutgoingRPC) ReadRawResults ¶ added in v0.8.0
func (or *OutgoingRPC) ReadRawResults() error
func (*OutgoingRPC) SetFilters ¶ added in v0.8.0
func (or *OutgoingRPC) SetFilters(filters []OutgoingRPCHandler)
func (*OutgoingRPC) SetHandler ¶ added in v0.8.0
func (or *OutgoingRPC) SetHandler(handler OutgoingRPCHandler)
func (*OutgoingRPC) SetReadCloser ¶ added in v0.8.0
func (or *OutgoingRPC) SetReadCloser(readCloser io.ReadCloser)
type OutgoingRPCHandler ¶ added in v0.8.0
type OutgoingRPCHandler func(ctx context.Context, outgoingRPC *OutgoingRPC) (err error)
type ReaderFunc ¶ added in v0.8.0
type TraceIDGenerator ¶
type TraceIDGenerator func() (traceID string)
type TransportFunc ¶
type ValidationContext ¶
func NewValidationContext ¶
func NewValidationContext(ctx context.Context) *ValidationContext
func (*ValidationContext) Enter ¶
func (vc *ValidationContext) Enter(pathComponent string)
func (*ValidationContext) ErrorDetails ¶
func (vc *ValidationContext) ErrorDetails() string
func (*ValidationContext) Leave ¶
func (vc *ValidationContext) Leave()
func (*ValidationContext) SetErrorDetails ¶
func (vc *ValidationContext) SetErrorDetails(errorDetails string)
Click to show internal directories.
Click to hide internal directories.