Documentation
¶
Index ¶
- Constants
- Variables
- func GetContext(c *gin.Context) scene.Context
- func Handle[A any, T Request[A]](app A, request T) gin.HandlerFunc
- func HttpMethod(method string) uint16
- func MiddlewareChain(middlewares ...gin.HandlerFunc) func(handler gin.HandlerFunc) []gin.HandlerFunc
- func NewAppContainer(addr string, apps []GinApplication, options ...GinOption) scene.Scene
- func NewAppContainerWithPrefix(addr string, prefix string, apps []GinApplication, options ...GinOption) scene.Scene
- func RequestWrapper[T any](app T) func(Request[T]) gin.HandlerFunc
- func WrapReq[A any, T Request[A]](app A, request T) gin.HandlerFunc
- type Action
- type AppRouter
- type AppRoutes
- type BaseAction
- type Context
- type GinApplication
- type GinOption
- type HttpRoute
- type HttpRouteInfo
- type ParameterBinder
- type Request
- type RequestForm
- type RequestFormUrlEncoded
- type RequestJson
- type RequestNoParam
- type RequestQuery
- type RequestURI
Constants ¶
View Source
const ( HttpMethodGet uint16 = 0b1 HttpMethodHead uint16 = 0b10 HttpMethodPost uint16 = 0b100 HttpMethodPut uint16 = 0b1000 HttpMethodPatch uint16 = 0b10000 // RFC 5789 HttpMethodDelete uint16 = 0b100000 HttpMethodConnect uint16 = 0b1000000 HttpMethodOptions uint16 = 0b10000000 HttpMethodTrace uint16 = 0b100000000 )
View Source
const SceneName = "scene.app-container.http.gin"
Variables ¶
View Source
var (
ErrAlreadyDone = errcode.CreateError(100, "gin already done")
)
Functions ¶
func HttpMethod ¶ added in v0.3.2
HttpMethod convert http.Method to uint16 version
func MiddlewareChain ¶
func MiddlewareChain(middlewares ...gin.HandlerFunc) func(handler gin.HandlerFunc) []gin.HandlerFunc
func NewAppContainer ¶
func NewAppContainer( addr string, apps []GinApplication, options ...GinOption, ) scene.Scene
func RequestWrapper ¶ added in v0.2.5
func RequestWrapper[T any](app T) func(Request[T]) gin.HandlerFunc
Types ¶
type Action ¶ added in v0.2.7
type Action[T any] interface { Request[T] HttpRoute Middleware() gin.HandlersChain }
type AppRouter ¶ added in v0.2.7
type AppRouter[T any] struct { // contains filtered or unexported fields }
func NewAppRouter ¶ added in v0.2.7
func (*AppRouter[T]) HandleAction ¶ added in v0.2.7
func (*AppRouter[T]) HandleActions ¶ added in v0.2.7
type AppRoutes ¶ added in v0.2.7
type AppRoutes[T any] struct { AppName scene.ImplName BasePath string Actions []Action[*T] Context T }
type BaseAction ¶ added in v0.2.7
type BaseAction struct {
}
func (*BaseAction) Middleware ¶ added in v0.2.7
func (a *BaseAction) Middleware() gin.HandlersChain
type GinApplication ¶
type GinOption ¶
func WithLogger ¶
func WithRecovery ¶
func WithRecovery() GinOption
type HttpRoute ¶ added in v0.3.2
type HttpRoute interface {
GetRoute() HttpRouteInfo
}
type HttpRouteInfo ¶ added in v0.3.2
type ParameterBinder ¶
type RequestForm ¶ added in v0.2.8
type RequestForm struct{}
func (*RequestForm) Binding ¶ added in v0.2.8
func (r *RequestForm) Binding() binding.Binding
type RequestFormUrlEncoded ¶ added in v0.2.8
type RequestFormUrlEncoded struct{}
func (*RequestFormUrlEncoded) Binding ¶ added in v0.2.8
func (r *RequestFormUrlEncoded) Binding() binding.Binding
type RequestJson ¶
type RequestJson struct{}
func (*RequestJson) Binding ¶
func (r *RequestJson) Binding() binding.Binding
type RequestNoParam ¶ added in v0.2.5
type RequestNoParam struct{}
func (*RequestNoParam) Binding ¶ added in v0.2.5
func (r *RequestNoParam) Binding() binding.Binding
type RequestQuery ¶
type RequestQuery struct{}
func (*RequestQuery) Binding ¶
func (r *RequestQuery) Binding() binding.Binding
type RequestURI ¶
type RequestURI struct{}
func (*RequestURI) Binding ¶
func (r *RequestURI) Binding() binding.Binding
Click to show internal directories.
Click to hide internal directories.