Documentation ¶
Index ¶
- type FuncDef
- type FuncOption
- type FuncOptions
- type Function
- type FunctionInvocation
- type Handler
- type HandlerInvocation
- type HandlerOption
- type HandlerOptions
- type Method
- type MethodDef
- type MethodInvocation
- type MethodOption
- type MethodOptions
- type Option
- type Options
- type Request
- type RequestBody
- type RequestExtension
- type RequestOption
- type RequestOptions
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FuncDef ¶
type FuncOption ¶
type FuncOption func(*FuncOptions)
type FuncOptions ¶
type Function ¶
type Function interface { Name() string Request() *FuncDef Response() *FuncDef Options() *FuncOptions }
func NewFunction ¶
func NewFunction(rf interface{}, opts ...FuncOption) (Function, error)
type FunctionInvocation ¶
type FunctionInvocation func(rf reflect.Type, opts ...FuncOption) (Function, error)
type Handler ¶
type Handler interface { Name() string Options() *HandlerOptions Methods() []Method Call(req Request, resp interface{}, opts ...HandlerOption) error NewRequest(string, ...RequestOption) Request Meta() map[string]map[string]string }
func NewHandler ¶
func NewHandler(v interface{}, opts ...HandlerOption) Handler
type HandlerInvocation ¶
type HandlerInvocation func(v interface{}, opts ...HandlerOption) Handler
type HandlerOption ¶
type HandlerOption func(*HandlerOptions)
func HandlerName ¶
func HandlerName(n string) HandlerOption
type HandlerOptions ¶
type Method ¶
type Method interface { Name() string Request() *MethodDef Response() *MethodDef Options() *MethodOptions }
type MethodDef ¶
type MethodInvocation ¶
type MethodInvocation func(rm reflect.Method, opts ...MethodOption) (Method, error)
type MethodOption ¶
type MethodOption func(*MethodOptions)
type MethodOptions ¶
type Request ¶
type Request interface { Context() context.Context Service() string Handler() string Method() string Body() RequestBody Headers() map[string]string }
Request describes the Service Call and contains the Body and Headers
func NewRequest ¶
func NewRequest(ctx context.Context, svc, hndlr, meth string, hdrs map[string]string, body RequestBody) Request
NewRequest returns a Request with functional argument construction
func NewRequestFromOptions ¶
func NewRequestFromOptions(opts ...RequestOption) Request
NewRequestFromOptions returns a new Request by declaritive construction
type RequestBody ¶
type RequestBody interface { ContentType() string Interface() interface{} Raw() ([]byte, error) Bind(interface{}) error }
RequestBody interface allows interaction with the raw request or Bind will map it onto a struct
func NewRequestBody ¶
func NewRequestBody(ct string, body interface{}) RequestBody
NewRequestBody returns a RequestBody with a specified Content-Type and arbitrary Content
type RequestExtension ¶
RequestExtension is middleware for Requests
type RequestOption ¶
type RequestOption func(*RequestOptions)
RequestOption acts as a setter for RequestOptions
func WithBody ¶
func WithBody(ctype string, body interface{}) RequestOption
WithBody sets the body of the request
func WithContext ¶
func WithContext(ctx context.Context) RequestOption
WithContext sets the Context of the Request
func WithHeaders ¶
func WithHeaders(hdrs map[string]string) RequestOption
WithHeaders sets the Headers of the Request
type RequestOptions ¶
type RequestOptions struct { Context context.Context Service string Handler string Method string Body RequestBody Headers map[string]string }
RequestOptions allows for declaritive construction of a Request
type Service ¶
type Service interface { Name() string Options() *Options Configure(...Option) Handle(Handler, ...HandlerOption) error Handler(string) Handler Handlers() []string Usage() string Call(req Request, resp interface{}) error }
Service interface allows registration of one or many handlers and provides a Call method to invoke methods on those handlers
func NewService ¶
NewService takes an initial handler (service wouldn't do much without one) and a set of options and returns a Service