Documentation
¶
Index ¶
- func InitCounter(opt prometheus.CounterOpts)
- func NewWarpLogger(l Logger)
- func Wrap[Req any, Res any](fn func(ctx *gin.Context, req Req) (Result[Res], error)) (string, string, gin.HandlerFunc)
- func WrapWithToken[Req any, Res any](fn func(ctx *gin.Context, req Req, u UserClaims) (Result[Res], error)) (string, string, gin.HandlerFunc)
- type Field
- type Limiter
- type Logger
- type Meta
- type Result
- type Server
- func (s *Server) Handle(method, path string, handler gin.HandlerFunc)
- func (s *Server) MarshalSpec() ([]byte, error)
- func (s *Server) RegisterOpenAPIRoutes(path string)
- func (s *Server) SaveOpenAPIToFile(path string) error
- func (s *Server) Start() error
- func (s *Server) Use(middleware ...gin.HandlerFunc)
- type UserClaims
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitCounter ¶
func InitCounter(opt prometheus.CounterOpts)
func NewWarpLogger ¶
func NewWarpLogger(l Logger)
func WrapWithToken ¶
Types ¶
type Logger ¶
type Logger interface {
Debug(msg string, args ...Field)
Info(msg string, args ...Field)
Warn(msg string, args ...Field)
Error(msg string, args ...Field)
}
var ( L Logger Oai = openapi.NewOpenAPI() )
type Server ¶
type Server struct {
*gin.Engine
OpenAPI *openapi.OpenAPI
// contains filtered or unexported fields
}
func (*Server) MarshalSpec ¶
func (*Server) RegisterOpenAPIRoutes ¶
RegisterOpenAPIRoutes Registers the routes to serve the OpenAPI spec and Swagger UI.
func (*Server) SaveOpenAPIToFile ¶
func (*Server) Use ¶
func (s *Server) Use(middleware ...gin.HandlerFunc)
type UserClaims ¶
type UserClaims struct {
Id int64
UserAgent string
Ssid string
jwt.RegisteredClaims
}
Directories
¶
| Path | Synopsis |
|---|---|
|
example
|
|
|
hello_world
command
|
|
|
jwt
command
|
|
|
prometheus
command
|
|
|
ratelimit
command
|
|
|
middleware
|
|
Click to show internal directories.
Click to hide internal directories.