Documentation
¶
Index ¶
- func DecodeRequest(r *http.Request, decoder Decoder, body any, args ...any) error
- func EncodeResponse[T Success](w http.ResponseWriter, encoder Encoder, value any, status *T)
- func GetEncDec(w http.ResponseWriter, r *http.Request) (Encoder, Decoder)
- func GetStatus[T Success](object *T) int
- type Accepted
- type Context
- type Created
- type Decoder
- type Encoder
- type HandleFunc1
- type HandleFunc2
- type HandleFunc3
- type HandleFunc4
- type HandleFunc5
- type HttpResponse
- type HttpStatus
- type NoContent
- type OK
- type Operation
- func DeleteHandler[T any, S Success](handler HandleFunc1[T, S], id string, summary string, tags []string) *Operation
- func GetHandler[H, V any, S Success](handler HandleFunc4[H, V, S], id string, summary string, tags []string) *Operation
- func Handle(handler http.Handler, options ...OperationFunc) *Operation
- func Handlers(operation *Operation, fn ...func(http.Handler) http.Handler) *Operation
- func NewOp1[H any, S Success](handler HandleFunc1[H, S], options ...OperationFunc) *Operation
- func NewOp2[H, B any, S Success](handler HandleFunc2[H, B, S], options ...OperationFunc) *Operation
- func NewOp3[H, B, R any, S Success](handler HandleFunc3[H, B, R, S], options ...OperationFunc) *Operation
- func NewOp4[H, R any, S Success](handler HandleFunc4[H, R, S], options ...OperationFunc) *Operation
- func NewOp5[H, B any](handler HandleFunc5[H, B], options ...OperationFunc) *Operation
- func PutHandler[H, B, V any, S Success](handler HandleFunc3[H, B, V, S], id string, summary string, tags []string) *Operation
- func Security(operation *Operation, s ...string) *Operation
- type OperationFunc
- func WithDescription(description string) OperationFunc
- func WithErrors(errors ...error) OperationFunc
- func WithHandlers(handlers ...func(http.Handler) http.Handler) OperationFunc
- func WithHeader(object any) OperationFunc
- func WithID(id string) OperationFunc
- func WithRequest(object any) OperationFunc
- func WithResponse(status int, object any) OperationFunc
- func WithSecurity(methods ...string) OperationFunc
- func WithSummary(summary string) OperationFunc
- func WithTags(tags ...string) OperationFunc
- type Request
- type Success
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeRequest ¶
func EncodeResponse ¶
func EncodeResponse[T Success](w http.ResponseWriter, encoder Encoder, value any, status *T)
Types ¶
type Accepted ¶
func (Accepted) HttpStatus ¶
type Created ¶
func (Created) HttpStatus ¶
type HandleFunc1 ¶
func (HandleFunc1[H, S]) ServeHTTP ¶
func (f HandleFunc1[H, S]) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HandleFunc2 ¶
func (HandleFunc2[H, B, S]) ServeHTTP ¶
func (f HandleFunc2[H, B, S]) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HandleFunc3 ¶
func (HandleFunc3[H, B, R, S]) ServeHTTP ¶
func (f HandleFunc3[H, B, R, S]) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HandleFunc4 ¶
func (HandleFunc4[H, V, R]) ServeHTTP ¶
func (f HandleFunc4[H, V, R]) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HandleFunc5 ¶
func (HandleFunc5[H, B]) ServeHTTP ¶
func (f HandleFunc5[H, B]) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HttpResponse ¶
type HttpResponse interface {
HttpResponse() errors.HttpResponse
}
type HttpStatus ¶
type HttpStatus interface {
HttpStatus() int
}
type NoContent ¶
func (NoContent) HttpStatus ¶
type Operation ¶
type Operation struct { http.Handler ID string Summary string Description string Tags []string Header any Request any Responses map[int]any Errors []error Security []string // contains filtered or unexported fields }
func DeleteHandler ¶
func GetHandler ¶
func NewOp1 ¶
func NewOp1[H any, S Success]( handler HandleFunc1[H, S], options ...OperationFunc, ) *Operation
func NewOp2 ¶
func NewOp2[H, B any, S Success]( handler HandleFunc2[H, B, S], options ...OperationFunc, ) *Operation
func NewOp3 ¶
func NewOp3[H, B, R any, S Success]( handler HandleFunc3[H, B, R, S], options ...OperationFunc, ) *Operation
NewOp3 define new operation with H path, query and header fields B request Body R response Body S if no err return from handler then return success
func NewOp4 ¶
func NewOp4[H, R any, S Success]( handler HandleFunc4[H, R, S], options ...OperationFunc, ) *Operation
NewOp4 define new operation with H path, query and header fields R response Body S if no err return from handler then return success This usable in GET requests.
func NewOp5 ¶
func NewOp5[H, B any]( handler HandleFunc5[H, B], options ...OperationFunc, ) *Operation
NewOp5 define new operation with H path, query and header fields R response Body S if no err return from handler then return success This usable in GET requests.
func PutHandler ¶
type OperationFunc ¶
type OperationFunc func(*Operation)
func WithDescription ¶
func WithDescription(description string) OperationFunc
func WithErrors ¶
func WithErrors(errors ...error) OperationFunc
func WithHandlers ¶
func WithHandlers(handlers ...func(http.Handler) http.Handler) OperationFunc
func WithHeader ¶
func WithHeader(object any) OperationFunc
func WithID ¶
func WithID(id string) OperationFunc
func WithRequest ¶
func WithRequest(object any) OperationFunc
func WithResponse ¶
func WithResponse(status int, object any) OperationFunc
func WithSecurity ¶
func WithSecurity(methods ...string) OperationFunc
func WithSummary ¶
func WithSummary(summary string) OperationFunc
func WithTags ¶
func WithTags(tags ...string) OperationFunc
Click to show internal directories.
Click to hide internal directories.