router

package
v0.0.0-...-8813fe1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindModel

func BindModel(req interface{}) fiber.Handler

func CookiesParser

func CookiesParser(c *fiber.Ctx, model interface{}) error

func HeaderParser

func HeaderParser(c *fiber.Ctx, model interface{}) error

func ParamsParser

func ParamsParser(c *fiber.Ctx, model interface{}) error

func ParseToStruct

func ParseToStruct(aliasTag string, out interface{}, data map[string][]string) error

Types

type ContentTypeType

type ContentTypeType string
var (
	ContentTypeRequest  ContentTypeType = "request"
	ContentTypeResponse ContentTypeType = "response"
)

type Model

type Model any

type Option

type Option func(router *Router)

func ContentType

func ContentType(contentType string, contentTypeType ContentTypeType) Option

ContentType Set request contentType

func Deprecated

func Deprecated() Option

Deprecated mark api is deprecated

func Description

func Description(description string) Option

func Exclude

func Exclude() Option

Exclude exclude in docs

func Handlers

func Handlers(handlers ...fiber.Handler) Option

func OperationID

func OperationID(ID string) Option

func Responses

func Responses(response Response) Option

func Security

func Security(securities ...security.ISecurity) Option

func Summary

func Summary(summary string) Option

func Tags

func Tags(tags ...string) Option

type Response

type Response map[string]ResponseItem

type ResponseItem

type ResponseItem struct {
	Description string
	Model       interface{}
	Headers     openapi3.Headers
}

type Router

type Router struct {
	Handlers            *list.List
	Path                string
	Method              string
	Summary             string
	Description         string
	Deprecated          bool
	RequestContentType  string
	ResponseContentType string
	Tags                []string
	API                 fiber.Handler
	Model               Model
	OperationID         string
	Exclude             bool
	Securities          []security.ISecurity
	Response            Response
}

func New

func New[T Model, F func(c *fiber.Ctx, req T) error](f F, options ...Option) *Router

func NewX

func NewX(f fiber.Handler, options ...Option) *Router

func (*Router) GetHandlers

func (router *Router) GetHandlers() []fiber.Handler

func (*Router) WithContentType

func (router *Router) WithContentType(contentType string, contentTypeType ContentTypeType) *Router

func (*Router) WithDeprecated

func (router *Router) WithDeprecated() *Router

func (*Router) WithDescription

func (router *Router) WithDescription(description string) *Router

func (*Router) WithExclude

func (router *Router) WithExclude() *Router

func (*Router) WithHandlers

func (router *Router) WithHandlers(handlers ...fiber.Handler) *Router

func (*Router) WithOperationID

func (router *Router) WithOperationID(ID string) *Router

func (*Router) WithResponses

func (router *Router) WithResponses(response Response) *Router

func (*Router) WithSecurity

func (router *Router) WithSecurity(securities ...security.ISecurity) *Router

func (*Router) WithSummary

func (router *Router) WithSummary(summary string) *Router

func (*Router) WithTags

func (router *Router) WithTags(tags ...string) *Router

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL