Documentation
¶
Index ¶
- Constants
- Variables
- type Caller
- type ConfigItem
- type Context
- func (c *Context) Decode(model interface{}, call Decoder) error
- func (c *Context) GetCookies() map[string]*http.Cookie
- func (c *Context) JSON(code int, model json.Marshaler, heads Headers) error
- func (c *Context) Redirect(url string) error
- func (c *Context) SetCookie(key, value string, ttl time.Duration)
- func (c *Context) Sign() (s Sign, err error)
- func (c *Context) Version() uint64
- func (c *Context) Write(code int, body []byte, heads Headers) error
- type Debug
- type DebugConfig
- type Decoder
- type Encoder
- type HTTPConfig
- type Handler
- type Headers
- type MiddlewareCaller
- type Route
- type RouteInjector
- type RouteItem
- type Router
- type Server
- type Sign
- type VerCaller
Constants ¶
View Source
const DefaultVersion uint64 = 1
Variables ¶
View Source
var (
ErrInvalidSignature = errors.New(`invalid signature format`)
)
Functions ¶
This section is empty.
Types ¶
type ConfigItem ¶
type ConfigItem struct {
Addr string `yaml:"addr" json:"addr"`
ReadTimeout time.Duration `yaml:"read_timeout" json:"read_timeout"`
WriteTimeout time.Duration `yaml:"write_timeout" json:"write_timeout"`
IdleTimeout time.Duration `yaml:"idle_timeout" json:"idle_timeout"`
}
ConfigItem ...
type Context ¶
type Context struct {
Writer http.ResponseWriter
Reader *http.Request
}
Context model
func (*Context) GetCookies ¶
GetCookies getting cookie of request
type Debug ¶
type Debug struct {
// contains filtered or unexported fields
}
Debug ...
func NewCustomDebug ¶
func NewCustomDebug(conf ConfigItem, log logger.Logger) *Debug
NewCustomDebug ...
type DebugConfig ¶
type DebugConfig struct {
Debug ConfigItem `yaml:"debug" json:"debug"`
}
DebugConfig ...
type HTTPConfig ¶
type HTTPConfig struct {
HTTP ConfigItem `yaml:"http" json:"http"`
}
HTTPConfig ...
type Handler ¶
type Handler struct {
Method []string
Path string
Call VerCaller
Middleware MiddlewareCaller
}
Handler ...
type MiddlewareCaller ¶ added in v1.1.0
MiddlewareCaller ...
type Route ¶
Route ...
func (*Route) InjectRoutes ¶ added in v1.1.0
func (o *Route) InjectRoutes(mod RouteInjector)
InjectRoutes ...
type RouteInjector ¶ added in v1.1.0
type RouteInjector interface {
Handlers() []Handler
}
RouteInjector ...
type RouteItem ¶ added in v1.1.0
type RouteItem struct {
Call VerCaller
Middleware MiddlewareCaller
}
RouteItem ...
type Router ¶
type Router interface {
AddRoutes(handlers ...Handler)
InjectRoutes(mod RouteInjector)
}
Router ...
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server ...
func NewCustomServer ¶
func NewCustomServer(conf ConfigItem, log logger.Logger) *Server
NewCustomServer ...
Click to show internal directories.
Click to hide internal directories.