router

package
v0.0.0-...-74deca1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Enum

type Enum map[string]EnumItem

type EnumItem

type EnumItem struct {
	Name        string
	Kind        string // `string` or `integer`
	Values      []any
	Description string
}

type Option

type Option func(router *Router)

func Deprecated

func Deprecated() Option

func Desc

func Desc(desc string) Option

func Enums

func Enums(enums Enum) Option

func Exclude

func Exclude() Option

func OperationID

func OperationID(ID string) Option

func Req

func Req(request Request) Option

func Resp

func Resp(response Response) Option

func Security

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

func Summary

func Summary(summary string) Option

func Tags

func Tags(tags ...string) Option

type Request

type Request struct {
	Description string
	Model       any
	Headers     openapi3.Headers
}

type Response

type Response map[string]ResponseItem

type ResponseItem

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

type Router

type Router struct {
	// middlewares
	Handlers            []gin.HandlerFunc
	Path                string
	Method              string
	Summary             string
	Description         string
	OperationID         string
	Deprecated          bool
	Exclude             bool
	RequestContentType  string
	ResponseContentType string
	Tags                []string

	// handler
	API        gin.HandlerFunc
	Model      any
	Securities []security.Security
	Response   Response
	Request    Request
	Enum       Enum
}

func NewRouter

func NewRouter[T any, F func(c *gin.Context, req T)](f F, options ...Option) *Router

func NewRouterX

func NewRouterX(f gin.HandlerFunc, options ...Option) *Router

func (*Router) GetHandlers

func (router *Router) GetHandlers() []gin.HandlerFunc

Jump to

Keyboard shortcuts

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