Documentation ¶
Index ¶
- Constants
- Variables
- func NewGinProxy() (gone.Goner, gone.GonerId)
- func NewGinResponser() (gone.Goner, gone.GonerId)
- func NewGinRouter() (gone.Goner, gone.GonerId, gone.GonerOption, gone.GonerOption, gone.Order)
- func NewGinServer() (gone.Goner, gone.GonerOption, gone.GonerOption)
- func NewHttInjector() (gone.Goner, gone.GonerId)
- func NewSysMiddleware() (gone.Goner, gone.GonerOption, gone.GonerOption)
- func Priest(cemetery gone.Cemetery) error
- type BindFieldFunc
- type BindStructFunc
- type BusinessError
- type Context
- type Controller
- type CustomResponseWriter
- type HandleProxyToGin
- type HandlerFunc
- type HttInjector
- type IRouter
- type IRoutes
- type Middleware
- type MountError
- type OriginContent
- type Responser
- type RouteGroup
- type RouterGroupName
- type SSE
- type Sse
- type SysMiddleware
- type WrappedDataFunc
- type XContext
Constants ¶
const TooManyRequests = "Too Many Requests"
Variables ¶
var NewBusinessError = gone.NewBusinessError
NewBusinessError 新建`业务错误`
var NewInnerError = gone.NewInnerError
NewInnerError 新建`内部错误`
var NewParameterError = gone.NewParameterError
NewParameterError 新建`参数错误`
var ToError = gone.ToError
ToError 转为错误
Functions ¶
func NewGinResponser ¶
NewGinResponser 新建系统默认的响应处理器 注入的ID为:gone-gin-responser (`gone.IdGoneGinResponser`)
func NewGinRouter ¶
func NewGinRouter() (gone.Goner, gone.GonerId, gone.GonerOption, gone.GonerOption, gone.Order)
NewGinRouter 用于创建系统根路由
func NewGinServer ¶
func NewGinServer() (gone.Goner, gone.GonerOption, gone.GonerOption)
func NewSysMiddleware ¶ added in v1.0.4
func NewSysMiddleware() (gone.Goner, gone.GonerOption, gone.GonerOption)
NewSysMiddleware create a new sys middleware
Types ¶
type BindFieldFunc ¶ added in v1.0.0
type BindStructFunc ¶ added in v1.0.0
type BusinessError ¶
type BusinessError = gone.BusinessError
BusinessError business error Business errors are special cases in business scenarios that need to return different data types in different business contexts; essentially not considered errors, but an abstraction to facilitate business writing, allowing the same interface to have the ability to return different business codes and business data in special cases
type Context ¶
Context The `gone` framework encapsulated context based on `gin` Deprecated use `gone.Context` instead
type Controller ¶
type Controller interface { // Mount Route mount interface, this interface will be called before the service starts, the implementation of this function should usually return `nil` Mount() MountError }
Controller interface, implemented by business code, used to mount and handle routes For usage reference [example code](https://gitlab.openviewtech.com/gone/gone-example/-/tree/master/gone-app)
type CustomResponseWriter ¶
type CustomResponseWriter struct { gin.ResponseWriter // contains filtered or unexported fields }
func (CustomResponseWriter) WriteString ¶
func (w CustomResponseWriter) WriteString(s string) (int, error)
type HandleProxyToGin ¶
type HandleProxyToGin interface { Proxy(handler ...HandlerFunc) []gin.HandlerFunc ProxyForMiddleware(handlers ...HandlerFunc) (arr []gin.HandlerFunc) }
HandleProxyToGin Proxy, provides a proxy function to convert `gone.HandlerFunc` to `gin.HandlerFunc` Inject `gin.HandleProxyToGin` using Id: sys-gone-proxy (`gin.SystemGoneProxy`)
type HandlerFunc ¶
type HandlerFunc = gone.HandlerFunc
HandlerFunc The `gone` framework route handler function
type HttInjector ¶ added in v1.0.0
type HttInjector interface { StartBindFuncs() BindFuncs() BindStructFunc }
type IRouter ¶
IRouter The `gone` framework encapsulated "router" based on `gin` Inject default router using Id: gone-gin-router (`gone.IdGoneGinRouter`)
type IRouter interface { // IRoutes 1. Composes `gone.IRoutes`, can define routes IRoutes // GetGinRouter 2. Can get the encapsulated ginRouter object, used to operate the original gin routes GetGinRouter() gin.IRouter // Group 3. Define route groups Group(string, ...HandlerFunc) RouteGroup LoadHTMLGlob(pattern string) }
type IRoutes ¶
IRoutes Routes encapsulated by the `gone` framework based on `gin`, used to define functions that handle specific requests Inject default routes using Id: gone-gin-router (`gone.IdGoneGinRouter`) To inject route dependencies into an object: ```go
func NewDependOnIRoutes() *DependOnIRoutes { return &DependOnIRoutes{} } type DependOnIRoutes struct { TheRoutes gone.IRoutes `gone:"gone-gin-router"` // Dependency injection system routes } func (*DependOnIRoutes) DoSomething() { // Operate on the routes //... }
```
type IRoutes interface { // Use Apply `gin` middleware on the route Use(...HandlerFunc) IRoutes Handle(string, string, ...HandlerFunc) IRoutes Any(string, ...HandlerFunc) IRoutes GET(string, ...HandlerFunc) IRoutes POST(string, ...HandlerFunc) IRoutes DELETE(string, ...HandlerFunc) IRoutes PATCH(string, ...HandlerFunc) IRoutes PUT(string, ...HandlerFunc) IRoutes OPTIONS(string, ...HandlerFunc) IRoutes HEAD(string, ...HandlerFunc) IRoutes }
type Middleware ¶ added in v1.0.4
type MountError ¶
type MountError = gone.GinMountError
MountError The type returned by `gin.Controller#Mount`, used to identify the implementation of `gin.Controller` to avoid being called incorrectly
type OriginContent ¶ added in v1.0.0
type Responser ¶
type Responser interface { Success(ctx XContext, data any) Failed(ctx XContext, err error) ProcessResults(context XContext, writer gin.ResponseWriter, last bool, funcName string, results ...any) }
Responser Response handler Inject default response handler using Id: gone-gin-responser (`gone.IdGoneGinResponser`)
type RouteGroup ¶
type RouteGroup = gone.RouteGroup
RouteGroup Route group Inject default route group using Id: gone-gin-router (`gone.IdGoneGinRouter`)
type RouteGroup interface { IRouter }
type Sse ¶ added in v0.3.0
type Sse struct {
Writer gin.ResponseWriter
}
type SysMiddleware ¶ added in v1.0.4
SysMiddleware system middleware
func (*SysMiddleware) AfterRevive ¶ added in v1.0.4
func (m *SysMiddleware) AfterRevive() error
func (*SysMiddleware) Process ¶ added in v1.0.4
func (m *SysMiddleware) Process(context *gin.Context)