Versions in this module Expand all Collapse all v0 v0.1.4 Dec 9, 2024 v0.1.3 Oct 21, 2024 v0.1.2 Sep 13, 2024 v0.1.1 Aug 30, 2024 v0.1.0 May 1, 2024 v0.0.1 Feb 21, 2024 Changes in this version + var DELETE_METHOD = http.MethodDelete + var GET_METHOD = http.MethodGet + var PATCH_METHOD = http.MethodPatch + var POST_METHOD = http.MethodPost + var PUT_METHOD = http.MethodPut + func EncodeResponse(s interface{}, err error, w http.ResponseWriter) error + func Forward(c *Controller) http.HandlerFunc + func IsRetryable(err error) (bool, time.Duration) + func NewErrorResponse(e *ControllerError, v interface{}) (s interface{}) + func Reject(c *Controller) http.HandlerFunc + type Controller struct + Log Logger + Name string + Port int + Routers Routers + Version string + func NewController(name string, port int, version string, routers Routers) *Controller + func (c *Controller) Attach(router *mux.Router, handlerFunc HandlerFunc) + func (c *Controller) Close() + func (c *Controller) Init(opts *Options) error + func (c *Controller) Run() error + func (c *Controller) Send(w http.ResponseWriter, r *http.Request) + func (ctrl *Controller) WithLogger(log Logger) *Controller + type ControllerError struct + Event interface{} + func NewControllerError(sc int) *ControllerError + func NewErrBadRequest() *ControllerError + func NewErrInternalServerError() *ControllerError + func NewErrNotAcceptable() *ControllerError + func NewErrNotFound() *ControllerError + func NewErrNotImplemented() *ControllerError + func NewErrorNotReady() *ControllerError + func (e *ControllerError) Cause() string + func (e *ControllerError) Error() string + func (e *ControllerError) IsRetryable() bool + func (e *ControllerError) ResourceType() string + func (e *ControllerError) RetryDelay() time.Duration + func (e *ControllerError) StatusCode() int + func (e *ControllerError) Unwrap() error + func (e *ControllerError) WithCause(cause string) *ControllerError + func (e *ControllerError) WithError(err error) *ControllerError + func (e *ControllerError) WithEvent(event interface{}) *ControllerError + func (e *ControllerError) WithResourceType(t string) *ControllerError + func (e *ControllerError) WithRetryDelay(delay time.Duration) *ControllerError + type ControllerProcessor interface + Close func() + Run func(c *Controller, options Options) error + Send func(c *Controller, w http.ResponseWriter, r *http.Request) + func NewControllerProcessor(http bool) ControllerProcessor + type DummyControllerProcessor struct + func (*DummyControllerProcessor) Close() + func (*DummyControllerProcessor) Run(c *Controller, options Options) error + func (*DummyControllerProcessor) Send(c *Controller, w http.ResponseWriter, r *http.Request) + type ErrorResponse struct + Cause string + Details string + Error string + Model string + Status int + type HandlerFunc func(c *Controller) http.HandlerFunc + type HttpControllerProcessor struct + func (p *HttpControllerProcessor) Close() + func (p *HttpControllerProcessor) Run(c *Controller, options Options) error + func (p *HttpControllerProcessor) Send(c *Controller, w http.ResponseWriter, r *http.Request) + type Logger = logr.Logger + type Options struct + Http bool + Log bool + Port int + Verbose bool + func BindFlags(fs *flag.FlagSet) *Options + func NewDefaultOptions() *Options + func NewDefaultTestOptions() *Options + type ResponseWriter struct + Buffer *bytes.Buffer + Hdr http.Header + StatusCode int + func NewResponseWriter() *ResponseWriter + func (r *ResponseWriter) Header() http.Header + func (r *ResponseWriter) Write(b []byte) (int, error) + func (r *ResponseWriter) WriteHeader(code int) + type Route struct + HandlerFunc http.HandlerFunc + Method string + Name string + Path string + type Router interface + Close func() error + Init func(Logger) error + Name func() string + Routes func() Routes + Start func() error + type Routers []Router + type Routes []Route