Documentation
¶
Index ¶
- func CaptchaHandler(debug bool) gin.HandlerFunc
- func ErrCodeHandler(c *gin.Context)
- func FlagSet(defaultPort int) *pflag.FlagSet
- func New(conf *Config, router *Routers, mwBefore, mwAfter []gin.HandlerFunc) (*http.Server, error)
- func Routes() []gin.RouteInfo
- func SetVersionHandler(version, commit string)
- type Config
- func (c *Config) Addr() string
- func (c *Config) Check() *Config
- func (c *Config) GetEndpoint() string
- func (s *Config) WithAuth(v bool) *Config
- func (s *Config) WithDebug(v bool) *Config
- func (s *Config) WithEndpoint(v string) *Config
- func (s *Config) WithHeaders(v []string) *Config
- func (s *Config) WithHost(v string) *Config
- func (s *Config) WithMetrics(v bool) *Config
- func (s *Config) WithOrigins(v []string) *Config
- func (s *Config) WithPort(v int) *Config
- func (s *Config) WithPprof(v bool) *Config
- func (s *Config) WithPrefix(v string) *Config
- func (s *Config) WithRequestID(v bool) *Config
- func (s *Config) WithSystem(v string) *Config
- type RegisterFunc
- type Routers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CaptchaHandler ¶
func CaptchaHandler(debug bool) gin.HandlerFunc
func ErrCodeHandler ¶
func SetVersionHandler ¶ added in v0.2.4
func SetVersionHandler(version, commit string)
Types ¶
type Config ¶
type Config struct {
System string `json:"system" yaml:"system"`
Prefix string `json:"prefix" yaml:"prefix" default:"/api"`
Endpoint string `json:"endpoint" yaml:"endpoint"`
Host string `json:"host" yaml:"host" default:"127.0.0.1"`
Port int `json:"port" yaml:"port" default:"8080"`
Origins []string `json:"origins" yaml:"origins"`
Headers []string `json:"headers" yaml:"headers"`
Debug bool `json:"debug" yaml:"debug"`
Pprof bool `json:"pprof" yaml:"pprof"`
RequestID bool `json:"requestid" yaml:"requestid"`
Metrics bool `json:"metrics" yaml:"metrics"`
Auth bool `json:"auth" yaml:"auth"`
}
func (*Config) GetEndpoint ¶
func (*Config) WithEndpoint ¶
func (*Config) WithHeaders ¶
func (*Config) WithMetrics ¶
func (*Config) WithOrigins ¶
func (*Config) WithPrefix ¶
func (*Config) WithRequestID ¶
func (*Config) WithSystem ¶
type RegisterFunc ¶
type RegisterFunc func(*gin.RouterGroup)
type Routers ¶
type Routers []RegisterFunc
func NewRouters ¶ added in v0.2.2
func NewRouters() *Routers
func (Routers) Apply ¶
func (rs Routers) Apply(g *gin.RouterGroup)
func (*Routers) Handle ¶ added in v0.1.6
func (rs *Routers) Handle(method, path string, f gin.HandlerFunc)
func (*Routers) Register ¶
func (rs *Routers) Register(f RegisterFunc)
Click to show internal directories.
Click to hide internal directories.