Documentation ¶
Index ¶
- Constants
- func WithDescription(val string) option
- func WithSecurity(key string) option
- func WithSummary(val string) option
- func WithTags(val ...string) option
- type CustomBinder
- func (b *CustomBinder) Bind(i interface{}, c echo.Context) (err error)
- func (b *CustomBinder) BindBody(c echo.Context, i interface{}) (err error)
- func (b *CustomBinder) BindCookies(c echo.Context, i interface{}) error
- func (b *CustomBinder) BindHeaders(c echo.Context, i interface{}) error
- func (b *CustomBinder) BindPathParams(c echo.Context, i interface{}) error
- func (b *CustomBinder) BindQueryParams(c echo.Context, i interface{}) error
- type CustomValidator
- type ErrResponse
- type ErrWithAppCode
- type ErrWithFields
- type ErrWithHTTPStatus
- type Group
- func (g *Group) DELETE(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
- func (g *Group) GET(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
- func (g *Group) PATCH(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
- func (g *Group) POST(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
- func (g *Group) PUT(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
- type HTTPCodeAsError
- type Handler
- type Interactor
- type NoContent
- type ParamIn
- type Scheme
- type Service
- func (s *Service) DELETE(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
- func (s *Service) Docs(pattern string, config ...map[string]any)
- func (s *Service) GET(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
- func (s *Service) Group(prefix string, ops ...option) *Group
- func (s *Service) PATCH(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
- func (s *Service) POST(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
- func (s *Service) PUT(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
- func (s *Service) WithAPIKeySecurity(key, name string, in openapi3.APIKeySecuritySchemeIn)
- func (s *Service) WithHttpBasicSecurity(key string)
- func (s *Service) WithHttpBearerSecurity(key string)
- func (s *Service) WithHttpSecurity(key string, scheme Scheme)
- func (s *Service) WithSecurity(key string, securityScheme *openapi3.SecurityScheme)
- func (s *Service) WithTags(val ...string)
- type ValidatorError
Constants ¶
const ( // ParamInPath indicates path parameters, such as `/users/{id}`. ParamInPath = ParamIn("path") // ParamInQuery indicates query parameters, such as `/users?page=10`. ParamInQuery = ParamIn("query") // ParamInBody indicates body value, such as `{"id": 10}`. ParamInBody = ParamIn("json") // ParamInFormData indicates body form parameters. ParamInForm = ParamIn("form") // ParamInFormData indicates body form parameters. ParamInFormData = ParamIn("formData") // ParamInCookie indicates cookie parameters, which are passed ParamIn the `Cookie` header, // such as `Cookie: debug=0; gdpr=2`. ParamInCookie = ParamIn("cookie") // ParamInHeader indicates header parameters, such as `X-Header: value`. ParamInHeader = ParamIn("header") )
const ( SchemeBearer = Scheme("bearer") SchemeBasic = Scheme("basic") )
Variables ¶
This section is empty.
Functions ¶
func WithDescription ¶ added in v0.2.2
func WithDescription(val string) option
func WithSecurity ¶ added in v0.2.2
func WithSecurity(key string) option
func WithSummary ¶ added in v0.2.2
func WithSummary(val string) option
Types ¶
type CustomBinder ¶
type CustomBinder struct{}
func (*CustomBinder) Bind ¶
func (b *CustomBinder) Bind(i interface{}, c echo.Context) (err error)
Bind implements the `Binder#Bind` function. Binding is done in following order: 1) path params; 2) query params; 3) request body. Each step COULD override previous step binded values. For single source binding use their own methods BindBody, BindQueryParams, BindPathParams.
func (*CustomBinder) BindBody ¶
func (b *CustomBinder) BindBody(c echo.Context, i interface{}) (err error)
BindBody binds request body contents to bindable object NB: then binding forms take note that this implementation uses standard library form parsing which parses form data from BOTH URL and BODY if content type is not MIMEMultipartForm See non-MIMEMultipartForm: https://golang.org/pkg/net/http/#Request.ParseForm See MIMEMultipartForm: https://golang.org/pkg/net/http/#Request.ParseMultipartForm
func (*CustomBinder) BindCookies ¶
func (b *CustomBinder) BindCookies(c echo.Context, i interface{}) error
func (*CustomBinder) BindHeaders ¶ added in v0.2.5
func (b *CustomBinder) BindHeaders(c echo.Context, i interface{}) error
BindHeaders binds HTTP headers to a bindable object
func (*CustomBinder) BindPathParams ¶
func (b *CustomBinder) BindPathParams(c echo.Context, i interface{}) error
BindPathParams binds path params to bindable object
func (*CustomBinder) BindQueryParams ¶ added in v0.2.5
func (b *CustomBinder) BindQueryParams(c echo.Context, i interface{}) error
BindQueryParams binds query params to bindable object
type CustomValidator ¶
type CustomValidator struct{}
func (*CustomValidator) Validate ¶
func (cv *CustomValidator) Validate(i any) error
type ErrResponse ¶
type ErrResponse struct { StatusText string `json:"status,omitempty" description:"Status text."` AppCode int `json:"code,omitempty" description:"Application-specific error code."` ErrorText string `json:"error,omitempty" description:"Error message."` Context map[string]interface{} `json:"context,omitempty" description:"Application context."` // contains filtered or unexported fields }
ErrResponse is HTTP error response body.
func Err ¶
func Err(err error) (int, ErrResponse)
type ErrWithAppCode ¶
ErrWithAppCode exposes application error code.
type ErrWithFields ¶
ErrWithFields exposes structured context of error.
type ErrWithHTTPStatus ¶
ErrWithHTTPStatus exposes HTTP status code.
type Group ¶ added in v0.2.0
type Group struct { *echo.Group // contains filtered or unexported fields }
func (*Group) DELETE ¶ added in v0.2.0
func (g *Group) DELETE(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
func (*Group) GET ¶ added in v0.2.0
func (g *Group) GET(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
func (*Group) PATCH ¶ added in v0.2.0
func (g *Group) PATCH(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
func (*Group) POST ¶ added in v0.2.0
func (g *Group) POST(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
func (*Group) PUT ¶ added in v0.2.0
func (g *Group) PUT(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
type HTTPCodeAsError ¶
type HTTPCodeAsError int
HTTPCodeAsError exposes HTTP status code as use case error that can be translated to response status.
func (HTTPCodeAsError) Error ¶
func (c HTTPCodeAsError) Error() string
Error return HTTP status text.
func (HTTPCodeAsError) HTTPStatus ¶
func (c HTTPCodeAsError) HTTPStatus() int
HTTPStatus returns HTTP status code.
type Handler ¶
type Handler[i, o any] struct { // contains filtered or unexported fields }
type Interactor ¶
type Interactor interface { Input() any Output() any Interact(c echo.Context, in, out any) error Options() []option Summary() string }
func NewHandler ¶
func NewHandler[i, o any](handler interact[i, o], ops ...option) Interactor
type Service ¶
func NewService ¶ added in v0.2.2
func (*Service) DELETE ¶
func (s *Service) DELETE(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
func (*Service) GET ¶
func (s *Service) GET(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
func (*Service) PATCH ¶
func (s *Service) PATCH(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
func (*Service) POST ¶
func (s *Service) POST(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
func (*Service) PUT ¶
func (s *Service) PUT(pattern string, h Interactor, middleware ...echo.MiddlewareFunc) *echo.Route
func (*Service) WithAPIKeySecurity ¶
func (s *Service) WithAPIKeySecurity(key, name string, in openapi3.APIKeySecuritySchemeIn)
func (*Service) WithHttpBasicSecurity ¶ added in v0.2.2
func (*Service) WithHttpBearerSecurity ¶ added in v0.2.2
func (*Service) WithHttpSecurity ¶
func (*Service) WithSecurity ¶
func (s *Service) WithSecurity(key string, securityScheme *openapi3.SecurityScheme)
type ValidatorError ¶
type ValidatorError struct { HTTPCodeAsError ValidationError *gojsonschema.ValidationError // contains filtered or unexported fields }
func (*ValidatorError) Error ¶ added in v0.2.1
func (*ValidatorError) Error() string
func (*ValidatorError) Fields ¶
func (ve *ValidatorError) Fields() map[string]any