Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context interface {
JSON(statusCode int, obj interface{})
String(statusCode int, format string, values ...interface{})
Param(key string) string
Query(key string) string
BindJSON(obj interface{}) error
Next()
Request() *http.Request
ClientIP() string
SetHeader(key, value string)
}
Context abstracts the HTTP context used by the framework
type HandlerFunc ¶
type HandlerFunc func(ctx Context)
HandlerFunc defines a generic HTTP handler function type
type Option ¶
type Option func(*Options)
func WithAddress ¶
WithAddress sets the address for the server
func WithMiddleware ¶
func WithMiddleware(middleware ...HandlerFunc) Option
WithMiddleware adds middleware to the server
func WithShutdownTimeout ¶
WithShutdownTimeout sets the shutdown timeout for the server
type Options ¶
type Options struct {
Address string
Mode string
ShutdownTimeout time.Duration
Middleware []HandlerFunc
Logger gin.HandlerFunc // Custom logger middleware
}
Options contains configurable settings for the Gin web server
type RouterGroup ¶
type RouterGroup interface {
GET(route string, handler HandlerFunc)
POST(route string, handler HandlerFunc)
PUT(route string, handler HandlerFunc)
PATCH(route string, handler HandlerFunc)
DELETE(route string, handler HandlerFunc)
OPTIONS(route string, handler HandlerFunc)
HEAD(route string, handler HandlerFunc)
}
RouterGroup abstracts route grouping
type Server ¶
type Server interface {
GET(route string, handler HandlerFunc)
POST(route string, handler HandlerFunc)
PUT(route string, handler HandlerFunc)
PATCH(route string, handler HandlerFunc)
DELETE(route string, handler HandlerFunc)
OPTIONS(route string, handler HandlerFunc)
HEAD(route string, handler HandlerFunc)
Group(prefix string) RouterGroup
Use(middleware ...HandlerFunc)
Start() error
Stop() error
}
Server defines the abstraction for the web server
func NewGinServer ¶
Click to show internal directories.
Click to hide internal directories.