Documentation ¶
Index ¶
- Constants
- Variables
- func Code(code int) *responseCode
- func Data(code int, v []byte) *responseData
- func Html(code int, v []byte) *responseHtml
- func JWTToken(payload map[string]any, secret []byte) (string, error)
- func Json(code int, v any) *responseJson
- func ParseJWT(token string, secret []byte) (map[string]any, error)
- func Redirect(code int, v string) *responseRedirect
- func String(code int, format string, v ...any) *responseString
- type AppConfig
- type CAppConfig
- type CTLSCertFile
- type CTLSKeyFile
- type Context
- func (ctx *Context) Body() []byte
- func (ctx *Context) Cookie(key string) *http.Cookie
- func (ctx *Context) File(key string) (multipart.File, *multipart.FileHeader, error)
- func (ctx *Context) Header(key string) string
- func (ctx *Context) Param(key string) string
- func (ctx *Context) PostForm(key string) string
- func (ctx *Context) Query(key string) string
- func (ctx *Context) Session() *orm.Session
- func (ctx *Context) SetCookie(c *http.Cookie)
- func (ctx *Context) SetHeader(key, value string)
- func (ctx *Context) SetMaxFileSize(v int64) error
- type Engine
- type Handler
- type IHandler
- type J
- type Response
- type RouteGroup
- func (group *RouteGroup) After(v ...func(*Context) Response)
- func (group *RouteGroup) Before(v ...func(*Context) Response)
- func (group *RouteGroup) Get(pattern string, handler func(*Context) Response)
- func (group *RouteGroup) Group(prefix string) *RouteGroup
- func (group *RouteGroup) Post(pattern string, handler func(*Context) Response)
Constants ¶
View Source
const DEFAULT_BUILD_NAME = "main"
View Source
const DEFAULT_CONFIG_PATH = "application.yaml"
DEFAULT_CONFIG_PATH 默认配置文件地址
Variables ¶
View Source
var ( LogInfo = infoLogger.Println LogInfof = infoLogger.Printf LogWarn = warnLogger.Println LogWarnf = warnLogger.Printf LogErr = errLogger.Println LogErrf = errLogger.Printf )
Functions ¶
Types ¶
type AppConfig ¶
type AppConfig struct { Main string `yaml:"main"` Port int `yaml:"port"` ReadTimeout int `yaml:"read-timeout"` WriteTimeout int `yaml:"write-timeout"` IdleTimeout int `yaml:"idle-timeout"` Production bool `yaml:"production"` Database struct { Source string `yaml:"source"` MaxOpenConns int `yaml:"max-open-conns"` MaxIdleConns int `yaml:"max-idle-conns"` } `yaml:"database"` Watch struct { Includes []string `yaml:"includes"` Excludes []string `yaml:"excludes"` Debounce int64 `yaml:"debounce"` } `yaml:"watch"` }
AppConfig 项目配置
func (*AppConfig) ParseContent ¶
ParseContent 解析配置内容
type CAppConfig ¶
type CAppConfig []byte // 项目配置
type CTLSCertFile ¶
type CTLSCertFile string // TLS证书
type CTLSKeyFile ¶
type CTLSKeyFile string // TLS密钥
type Context ¶
type Context struct { Req *http.Request Writer http.ResponseWriter Method string Path string Params map[string]string // contains filtered or unexported fields }
Context 上下文
func NewContext ¶
NewContext 新建上下文
func (*Context) SetMaxFileSize ¶
SetMaxFileSize 设置允许最大内存及文件大小,单位字节
type Engine ¶
type Engine struct { *RouteGroup // contains filtered or unexported fields }
Engine Web引擎
type RouteGroup ¶
type RouteGroup struct {
// contains filtered or unexported fields
}
RouteGroup 分组路由
func (*RouteGroup) After ¶
func (group *RouteGroup) After(v ...func(*Context) Response)
After 添加后置处理拦截器
func (*RouteGroup) Before ¶
func (group *RouteGroup) Before(v ...func(*Context) Response)
Before 添加拦截器
Source Files ¶
Click to show internal directories.
Click to hide internal directories.