Documentation ¶
Index ¶
- Constants
- Variables
- func InitSession()
- func NewCookie(name string, value string, age ...int64) *http.Cookie
- func NewSecureCookie(secret, name string, val string, age ...int64) *http.Cookie
- type AbortError
- type AppConfig
- type Body
- type Context
- func (c *Context) Abort(status int, body ...string)
- func (c *Context) Action() interface{}
- func (c *Context) ActionTag(fieldName string) string
- func (c *Context) ActionValue() reflect.Value
- func (c *Context) Body() []byte
- func (c *Context) Cookie(key string, defaults ...string) string
- func (c *Context) CookieBool(key string, defaults ...bool) bool
- func (c *Context) CookieEscape(key string, defaults ...string) string
- func (c *Context) CookieFloat32(key string, defaults ...float32) float32
- func (c *Context) CookieFloat64(key string, defaults ...float64) float64
- func (c *Context) CookieInt(key string, defaults ...int) int
- func (c *Context) CookieInt32(key string, defaults ...int32) int32
- func (c *Context) CookieInt64(key string, defaults ...int64) int64
- func (c *Context) CookieUint(key string, defaults ...uint) uint
- func (c *Context) CookieUint32(key string, defaults ...uint32) uint32
- func (c *Context) CookieUint64(key string, defaults ...uint64) uint64
- func (c *Context) Cookies() Cookies
- func (c *Context) DataJSON(args ...interface{})
- func (c *Context) DecodeJSONBody(v interface{}) error
- func (c *Context) DeleteSession(key string)
- func (c *Context) Download(data []byte)
- func (c *Context) File(filePath string)
- func (c *Context) Form(key string, defaults ...string) string
- func (c *Context) FormBool(key string, defaults ...bool) bool
- func (c *Context) FormEscape(key string, defaults ...string) string
- func (c *Context) FormFloat32(key string, defaults ...float32) float32
- func (c *Context) FormFloat64(key string, defaults ...float64) float64
- func (c *Context) FormInt(key string, defaults ...int) int
- func (c *Context) FormInt32(key string, defaults ...int32) int32
- func (c *Context) FormInt64(key string, defaults ...int64) int64
- func (c *Context) FormStrings(key string, defaults ...[]string) []string
- func (c *Context) FormTrimmed(key string, defaults ...string) string
- func (c *Context) FormUint(key string, defaults ...uint) uint
- func (c *Context) FormUint32(key string, defaults ...uint32) uint32
- func (c *Context) FormUint64(key string, defaults ...uint64) uint64
- func (c *Context) Forms() *Forms
- func (c *Context) GetFile(key string) (multipart.File, *multipart.FileHeader, error)
- func (c *Context) GetFiles(key string) ([]*multipart.FileHeader, error)
- func (c *Context) GetHeader(key string) string
- func (c *Context) GetSession(key string) interface{}
- func (c *Context) HTML(name string, data ...interface{})
- func (c *Context) HandleError()
- func (c *Context) Host() string
- func (c *Context) IP() (ip string)
- func (c *Context) IsAjax() bool
- func (c *Context) IsWeChat() bool
- func (c *Context) IsWebsocket() bool
- func (c *Context) JSON(data interface{})
- func (c *Context) Next()
- func (c *Context) NotFound(msg ...string)
- func (c *Context) Param(key string, defaults ...string) string
- func (c *Context) ParamBool(key string, defaults ...bool) bool
- func (c *Context) ParamEscape(key string, defaults ...string) string
- func (c *Context) ParamFloat32(key string, defaults ...float32) float32
- func (c *Context) ParamFloat64(key string, defaults ...float64) float64
- func (c *Context) ParamInt(key string, defaults ...int) int
- func (c *Context) ParamInt32(key string, defaults ...int32) int32
- func (c *Context) ParamInt64(key string, defaults ...int64) int64
- func (c *Context) ParamStrings(key string, defaults ...[]string) []string
- func (c *Context) ParamUint(key string, defaults ...uint) uint
- func (c *Context) ParamUint32(key string, defaults ...uint32) uint32
- func (c *Context) ParamUint64(key string, defaults ...uint64) uint64
- func (c *Context) Params() *Params
- func (c *Context) Queries() *Queries
- func (c *Context) Query(key string, defaults ...string) string
- func (c *Context) QueryBool(key string, defaults ...bool) bool
- func (c *Context) QueryEscape(key string, defaults ...string) string
- func (c *Context) QueryFloat32(key string, defaults ...float32) float32
- func (c *Context) QueryFloat64(key string, defaults ...float64) float64
- func (c *Context) QueryInt(key string, defaults ...int) int
- func (c *Context) QueryInt32(key string, defaults ...int32) int32
- func (c *Context) QueryInt64(key string, defaults ...int64) int64
- func (c *Context) QueryStrings(key string, defaults ...[]string) []string
- func (c *Context) QueryUint(key string, defaults ...uint) uint
- func (c *Context) QueryUint32(key string, defaults ...uint32) uint32
- func (c *Context) QueryUint64(key string, defaults ...uint64) uint64
- func (c *Context) Redirect(url string, status ...int)
- func (c *Context) Referer() string
- func (c *Context) Render(statusCode int, r render.Render)
- func (c *Context) Req() *http.Request
- func (c *Context) Route() *Route
- func (c *Context) SaveToFile(fromFile, toFile string) error
- func (c *Context) ServerHTML(statusCode int, name string, data ...interface{})
- func (c *Context) ServerJSON(statusCode int, data interface{})
- func (c *Context) ServerString(statusCode int, msg string)
- func (c *Context) ServerXML(statusCode int, data interface{})
- func (c *Context) SessionBool(key string) bool
- func (c *Context) SessionInt(key string) int
- func (c *Context) SessionInt64(key string) int64
- func (c *Context) SessionString(key string) string
- func (c *Context) SetCookie(key, value string, maxAge int, path, domain string, secure, httpOnly bool)
- func (c *Context) SetHeader(key, value string)
- func (c *Context) SetRequest(r *http.Request)
- func (c *Context) SetSession(key string, v interface{})
- func (c *Context) String(msg string)
- func (c *Context) UserAgent() string
- func (c *Context) XML(data interface{})
- type Contexter
- type Controller
- type Cookies
- type DataResponse
- type Engine
- func (engine *Engine) AddFuncMap(key string, fn interface{})
- func (engine *Engine) Any(p string, c interface{}, middlewares ...Handler)
- func (engine *Engine) Delete(p string, c interface{}, middlewares ...Handler)
- func (engine *Engine) Get(p string, c interface{}, middlewares ...Handler)
- func (engine *Engine) Group(p string, o interface{}, handlers ...Handler)
- func (engine *Engine) Head(p string, c interface{}, middlewares ...Handler)
- func (engine *Engine) NotFoundHandler(handler Handler)
- func (engine *Engine) Options(p string, c interface{}, middlewares ...Handler)
- func (engine *Engine) Patch(p string, c interface{}, middlewares ...Handler)
- func (engine *Engine) Post(p string, c interface{}, middlewares ...Handler)
- func (engine *Engine) Put(p string, c interface{}, middlewares ...Handler)
- func (engine *Engine) Run(args ...interface{}) (err error)
- func (engine *Engine) RunTLS(certFile, keyFile string, args ...interface{}) (err error)
- func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (engine *Engine) SetAppConfig(app *AppConfig)
- func (engine *Engine) SetDelims(left, right string)
- func (engine *Engine) SetSessionOn(on bool)
- func (engine *Engine) SetView(path ...string)
- func (engine *Engine) Static(relativePath, root string)
- func (engine *Engine) Trace(p string, c interface{}, middlewares ...Handler)
- func (engine *Engine) Use(handlers ...Handler)
- func (engine *Engine) UseHandler(handler http.Handler)
- type ErrorKeyIsNotExist
- type ErrorWithCode
- type Forms
- func (f *Forms) Bool(key string) (bool, error)
- func (f *Forms) Escape(key string) (string, error)
- func (f *Forms) Float32(key string) (float32, error)
- func (f *Forms) Float64(key string) (float64, error)
- func (f *Forms) Int(key string) (int, error)
- func (f *Forms) Int32(key string) (int32, error)
- func (f *Forms) Int64(key string) (int64, error)
- func (f *Forms) MustBool(key string, defaults ...bool) bool
- func (f *Forms) MustEscape(key string, defaults ...string) string
- func (f *Forms) MustFloat32(key string, defaults ...float32) float32
- func (f *Forms) MustFloat64(key string, defaults ...float64) float64
- func (f *Forms) MustInt(key string, defaults ...int) int
- func (f *Forms) MustInt32(key string, defaults ...int32) int32
- func (f *Forms) MustInt64(key string, defaults ...int64) int64
- func (f *Forms) MustString(key string, defaults ...string) string
- func (f *Forms) MustStrings(key string, defaults ...[]string) []string
- func (f *Forms) MustTrimmed(key string, defaults ...string) string
- func (f *Forms) MustUint(key string, defaults ...uint) uint
- func (f *Forms) MustUint32(key string, defaults ...uint32) uint32
- func (f *Forms) MustUint64(key string, defaults ...uint64) uint64
- func (f *Forms) String(key string) (string, error)
- func (f *Forms) Strings(key string) ([]string, error)
- func (f *Forms) Trimmed(key string) (string, error)
- func (f *Forms) Uint(key string) (uint, error)
- func (f *Forms) Uint32(key string) (uint32, error)
- func (f *Forms) Uint64(key string) (uint64, error)
- func (f *Forms) Values() url.Values
- type Group
- func (g *Group) Any(p string, c interface{}, middlewares ...Handler)
- func (g *Group) Delete(p string, c interface{}, middlewares ...Handler)
- func (g *Group) Get(p string, c interface{}, middlewares ...Handler)
- func (g *Group) Group(p string, o interface{}, handlers ...Handler)
- func (g *Group) Handle(method, p string, c interface{}, middlewares ...Handler)
- func (g *Group) Head(url, p string, c interface{}, middlewares ...Handler)
- func (g *Group) Options(p string, c interface{}, middlewares ...Handler)
- func (g *Group) Patch(p string, c interface{}, middlewares ...Handler)
- func (g *Group) Post(p string, c interface{}, middlewares ...Handler)
- func (g *Group) Put(p string, c interface{}, middlewares ...Handler)
- func (g *Group) Trace(p string, c interface{}, middlewares ...Handler)
- func (g *Group) Use(handlers ...Handler)
- type H
- type Handler
- type HandlerFunc
- func Contexts() HandlerFunc
- func DataPager() HandlerFunc
- func Errors() HandlerFunc
- func Logger() HandlerFunc
- func Param() HandlerFunc
- func Recovery() HandlerFunc
- func Return() HandlerFunc
- func Session() HandlerFunc
- func Static(opts ...StaticOptions) HandlerFunc
- func WrapAfter(handler http.Handler) HandlerFunc
- func WrapBefore(handler http.Handler) HandlerFunc
- type JSON
- type Json
- type Pager
- type Paramer
- type Params
- func (p *Params) Bool(key string) (bool, error)
- func (p *Params) Escape(key string) (string, error)
- func (p *Params) Float32(key string) (float32, error)
- func (p *Params) Float64(key string) (float64, error)
- func (p *Params) Get(key string) string
- func (p *Params) Int(key string) (int, error)
- func (p *Params) Int32(key string) (int32, error)
- func (p *Params) Int64(key string) (int64, error)
- func (p *Params) MustBool(key string, defaults ...bool) bool
- func (p *Params) MustEscape(key string, defaults ...string) string
- func (p *Params) MustFloat32(key string, defaults ...float32) float32
- func (p *Params) MustFloat64(key string, defaults ...float64) float64
- func (p *Params) MustInt(key string, defaults ...int) int
- func (p *Params) MustInt32(key string, defaults ...int32) int32
- func (p *Params) MustInt64(key string, defaults ...int64) int64
- func (p *Params) MustString(key string, defaults ...string) string
- func (p *Params) MustStrings(key string, defaults ...[]string) []string
- func (p *Params) MustUint(key string, defaults ...uint) uint
- func (p *Params) MustUint32(key string, defaults ...uint32) uint32
- func (p *Params) MustUint64(key string, defaults ...uint64) uint64
- func (p *Params) Set(key, value string)
- func (p *Params) SetParams(params []param)
- func (p *Params) String(key string) (string, error)
- func (p *Params) Strings(key string) ([]string, error)
- func (p *Params) Uint(key string) (uint, error)
- func (p *Params) Uint32(key string) (uint32, error)
- func (p *Params) Uint64(key string) (uint64, error)
- type Queries
- func (f *Queries) Bool(key string) (bool, error)
- func (f *Queries) Escape(key string) (string, error)
- func (f *Queries) Float32(key string) (float32, error)
- func (f *Queries) Float64(key string) (float64, error)
- func (f *Queries) Int(key string) (int, error)
- func (f *Queries) Int32(key string) (int32, error)
- func (f *Queries) Int64(key string) (int64, error)
- func (f *Queries) MustBool(key string, defaults ...bool) bool
- func (f *Queries) MustEscape(key string, defaults ...string) string
- func (f *Queries) MustFloat32(key string, defaults ...float32) float32
- func (f *Queries) MustFloat64(key string, defaults ...float64) float64
- func (f *Queries) MustInt(key string, defaults ...int) int
- func (f *Queries) MustInt32(key string, defaults ...int32) int32
- func (f *Queries) MustInt64(key string, defaults ...int64) int64
- func (f *Queries) MustString(key string, defaults ...string) string
- func (f *Queries) MustStrings(key string, defaults ...[]string) []string
- func (f *Queries) MustUint(key string, defaults ...uint) uint
- func (f *Queries) MustUint32(key string, defaults ...uint32) uint32
- func (f *Queries) MustUint64(key string, defaults ...uint64) uint64
- func (f *Queries) String(key string) (string, error)
- func (f *Queries) Strings(key string) ([]string, error)
- func (f *Queries) Uint(key string) (uint, error)
- func (f *Queries) Uint32(key string) (uint32, error)
- func (f *Queries) Uint64(key string) (uint64, error)
- func (f *Queries) Values() url.Values
- type ResponseTyper
- type ResponseWriter
- type Route
- type RouteType
- type RouterInterface
- type Set
- type StaticOptions
- type StatusResult
- type XML
- type XMLError
- type XMLString
- type Xml
Constants ¶
const (
DefaultProdConfig = "conf/prod.app.conf"
)
Variables ¶
var ( SupportMethods = []string{ "GET", "POST", "HEAD", "DELETE", "PUT", "OPTIONS", "TRACE", "PATCH", } PoolSize = 10 )
Functions ¶
func InitSession ¶
func InitSession()
InitSession init gku session
before using session,please call this function first
Types ¶
type AbortError ¶
AbortError defines an interface to describe HTTP error
func Forbidden ¶
func Forbidden(content ...string) AbortError
Forbidden returns forbidden HTTP error
func InternalServerError ¶
func InternalServerError(content ...string) AbortError
InternalServerError returns internal server HTTP error
func NotSupported ¶
func NotSupported(content ...string) AbortError
NotSupported returns not supported HTTP error
func Unauthorized ¶
func Unauthorized(content ...string) AbortError
Unauthorized returns unauthorized HTTP error
type AppConfig ¶
type AppConfig struct { AppName string //应用名称 RunMode string //运行模板 HttpAddr string //监听端口 AutoRender bool //是否自动渲染html模板 Views string //html模板目录 TemplateLeft string //模板符号 TemplateRight string //模板符号 SessionOn bool //是否打开session }
AppConfig gku app 统一配置入口
可以通过AppConfig完成统一的app基础配置
func GetAppConfig ¶
func GetAppConfig() *AppConfig
GetAppConfig 获取配置文件中的信息
默认使用conf/app.conf配置文件 当环境变量 APP_RUN_MODE ="prod"时,使用 conf/prod.app.conf 当环境变量 APP_RUN_MODE ="dev"时,使用 conf/dev.app.conf 没有此环境变量时,使用conf/app.conf
type Context ¶
type Context struct { ResponseWriter //Data html template data msp Data map[interface{}]interface{} Result interface{} Pager *Pager // contains filtered or unexported fields }
Context gku context
func (*Context) ActionValue ¶
ActionValue returns action value
func (*Context) CookieBool ¶
CookieBool returns cookie as bool with default
func (*Context) CookieEscape ¶
CookieEscape returns cookie as escaped string with default
func (*Context) CookieFloat32 ¶
CookieFloat32 returns cookie as float32 with default
func (*Context) CookieFloat64 ¶
CookieFloat64 returns cookie as float64 with default
func (*Context) CookieInt32 ¶
CookieInt32 returns cookie as int32 with default
func (*Context) CookieInt64 ¶
CookieInt64 returns cookie as int64 with default
func (*Context) CookieUint ¶
CookieUint returns cookie as uint with default
func (*Context) CookieUint32 ¶
CookieUint32 returns cookie as uint32 with default
func (*Context) CookieUint64 ¶
CookieUint64 returns cookie as uint64 with default
func (*Context) DataJSON ¶
func (c *Context) DataJSON(args ...interface{})
DataJSON DataJSON json data
response format json
func (*Context) DeleteSession ¶
DeleteSession delete session key
func (*Context) FormEscape ¶
FormEscape returns request form as escaped string with default
func (*Context) FormFloat32 ¶
FormFloat32 returns request form as float32 with default
func (*Context) FormFloat64 ¶
FormFloat64 returns request form as float64 with default
func (*Context) FormStrings ¶
FormStrings returns request form as strings with default
func (*Context) FormTrimmed ¶
FormTrimmed returns request form as string with default and trimmed spaces
func (*Context) FormUint32 ¶
FormUint32 returns request form as uint32 with default
func (*Context) FormUint64 ¶
FormUint64 returns request form as uint64 with default
func (*Context) GetFiles ¶
func (c *Context) GetFiles(key string) ([]*multipart.FileHeader, error)
GetFiles GetFiles
func (*Context) GetSession ¶
GetSession return interface
func (*Context) HTML ¶
HTML render html page
When inputting data, use the value of data, otherwise use c.Data
func (*Context) HandleError ¶
func (c *Context) HandleError()
func (*Context) IsWebsocket ¶
IsWebsocket return is websocket request
func (*Context) ParamEscape ¶
ParamEscape returns request form as escaped string with default
func (*Context) ParamFloat32 ¶
ParamFloat32 returns request form as float32 with default
func (*Context) ParamFloat64 ¶
ParamFloat64 returns request form as float64 with default
func (*Context) ParamInt32 ¶
ParamInt32 returns request form as int32 with default
func (*Context) ParamInt64 ¶
ParamInt64 returns request form as int64 with default
func (*Context) ParamStrings ¶
ParamStrings returns request form as slice of string with default
func (*Context) ParamUint32 ¶
ParamUint32 returns request form as uint32 with default
func (*Context) ParamUint64 ¶
ParamUint64 returns request form as uint64 with default
func (*Context) QueryEscape ¶
QueryEscape returns request form as escaped string with default
func (*Context) QueryFloat32 ¶
QueryFloat32 returns request form as float32 with default
func (*Context) QueryFloat64 ¶
FormFloat64 returns request form as float64 with default
func (*Context) QueryInt32 ¶
QueryInt32 returns request form as int32 with default
func (*Context) QueryInt64 ¶
QueryInt64 returns request form as int64 with default
func (*Context) QueryStrings ¶
QueryStrings returns request form as strings with default
func (*Context) QueryUint32 ¶
QueryUint32 returns request form as uint32 with default
func (*Context) QueryUint64 ¶
QueryUint64 returns request form as uint64 with default
func (*Context) Redirect ¶
Redirect redirect the request to another URL
Redirect("/login",302) Redirect("http://zituo.net",301)
func (*Context) SaveToFile ¶
SaveToFile saves uploaded file to new path.
upload the file and save it on the server c.SaveToFile("file","./upload/1.jpg")
func (*Context) ServerHTML ¶
ServerHTML
When inputting data, use the value of data, otherwise use c.Data
func (*Context) ServerJSON ¶
ServerJSON
func (*Context) ServerString ¶
ServerString ServerString
func (*Context) SessionString ¶
SessionString return string
func (*Context) SetCookie ¶
func (c *Context) SetCookie(key, value string, maxAge int, path, domain string, secure, httpOnly bool)
SetCookie set cookie
c.SetCookie("username", "gku", 72*time.Hour, "", true, true)
func (*Context) SetRequest ¶
func (*Context) SetSession ¶
SetSession set session
type Controller ¶
type Controller struct {
*Context
}
Controller implements Contexter
func (*Controller) SetContext ¶
func (c *Controller) SetContext(ctx *Context)
SetContext set *Context to action struct
type Cookies ¶
type Cookies interface { Set Get(string) *http.Cookie Set(*http.Cookie) Expire(string, time.Time) Del(string) }
Cookies describes cookie interface
type DataResponse ¶
type DataResponse struct { Code int `json:"code"` Msg string `json:"msg"` STime string `json:"stime"` Time int `json:"time"` Body *Body `json:"body"` }
DataResponse data json response struct
type Engine ¶
type Engine struct { AppName string RunMode string AppPath string http.Server RouterInterface ErrHandler Handler //template FuncMap template.FuncMap AutoRender bool HTMLRender render.Render MaxMultipartMemory int64 // contains filtered or unexported fields }
Engine gku engine
func (*Engine) NotFoundHandler ¶
NotFoundHandler custom page not found
func (*Engine) ServeHTTP ¶
func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request)
ServeHTTP ServeHTTP
func (*Engine) UseHandler ¶
UseHandler adds a standard http handler to engine's
type ErrorKeyIsNotExist ¶
type ErrorKeyIsNotExist struct {
Key string
}
func (ErrorKeyIsNotExist) Error ¶
func (e ErrorKeyIsNotExist) Error() string
type ErrorWithCode ¶
ErrorWithCode descripts an error that with error code
type Forms ¶
Forms a new enhancement of http.Request
func (*Forms) MustEscape ¶
MustEscape returns request form as escaped string with default
func (*Forms) MustFloat32 ¶
MustFloat32 returns request form as float32 with default
func (*Forms) MustFloat64 ¶
MustFloat64 returns request form as float64 with default
func (*Forms) MustString ¶
MustString returns request form as string with default
func (*Forms) MustStrings ¶
MustStrings returns request form as strings with default
func (*Forms) MustTrimmed ¶
MustTrimmed returns request form as string with default
func (*Forms) MustUint32 ¶
MustUint32 returns request form as uint32 with default
func (*Forms) MustUint64 ¶
MustUint64 returns request form as uint64 with default
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group defines a route group
type HandlerFunc ¶
type HandlerFunc func(c *Context)
func Contexts ¶
func Contexts() HandlerFunc
Contexts returns a middleware to inject Context to action struct
func Errors ¶
func Errors() HandlerFunc
Errors returns default error handler, you can use your self handler
func Logger ¶
func Logger() HandlerFunc
func Recovery ¶
func Recovery() HandlerFunc
func Session ¶
func Session() HandlerFunc
Session session middleware
r := gku.Default() r.Use(gku.Session())
func WrapAfter ¶
func WrapAfter(handler http.Handler) HandlerFunc
WrapAfter wraps a http standard handler to tango's after action executes
func WrapBefore ¶
func WrapBefore(handler http.Handler) HandlerFunc
WrapBefore wraps a http standard handler to gku's before action executes
func (HandlerFunc) Handle ¶
func (h HandlerFunc) Handle(c *Context)
type Pager ¶
type Pager struct { Page int64 `json:"page"` Limit int64 `json:"limit"` Offset int64 `json:"offset"` Count int64 `json:"count"` PageCount int64 `json:"page_count"` }
Pager
type Paramer ¶
type Paramer interface {
SetParams([]param)
}
Paramer defines an interface to get params
type Params ¶
type Params []param
Params defines params of http request
func (*Params) MustEscape ¶
MustEscape returns request form as escaped string with default
func (*Params) MustFloat32 ¶
MustFloat32 returns request form as float32 with default
func (*Params) MustFloat64 ¶
MustFloat64 returns request form as float64 with default
func (*Params) MustString ¶
MustString returns request form as slice of string with default
func (*Params) MustStrings ¶
MustStrings returns request form as slice of string with default
func (*Params) MustUint32 ¶
MustUint32 returns request form as uint32 with default
func (*Params) MustUint64 ¶
MustUint64 returns request form as uint64 with default
type Queries ¶
Queries a new enhancement of http.Request
func (*Queries) MustEscape ¶
MustEscape returns request form as escaped string with default
func (*Queries) MustFloat32 ¶
MustFloat32 returns request form as float32 with default
func (*Queries) MustFloat64 ¶
MustFloat64 returns request form as float64 with default
func (*Queries) MustString ¶
MustString returns request form as string with default
func (*Queries) MustStrings ¶
MustStrings returns request form as strings with default
func (*Queries) MustUint32 ¶
MustUint32 returns request form as uint32 with default
func (*Queries) MustUint64 ¶
MustUint64 returns request form as uint64 with default
type ResponseTyper ¶
type ResponseTyper interface {
ResponseType() int
}
ResponseTyper describes reponse type
type ResponseWriter ¶
type ResponseWriter interface { http.ResponseWriter http.Flusher http.Hijacker Status() int Written() bool Size() int }
ResponseWriter http response interface
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Route HTTP route
func NewRoute ¶
func NewRoute(v interface{}, t reflect.Type, method reflect.Value, tp RouteType, handlers []Handler) *Route
NewRoute return a route
type RouteType ¶
type RouteType byte
const ( FuncRoute RouteType = iota + 1 // 1 func () FuncHTTPRoute // 2 func (http.ResponseWriter, *http.Request) FuncReqRoute // 3 func (*http.Request) FuncResponseRoute // 4 func (http.ResponseWriter) FuncCtxRoute // 5 func (*tango.Context) StructRoute // 6 func (st) <Get>() StructPtrRoute // 7 func (*struct) <Get>() )
type RouterInterface ¶
type RouterInterface interface { Handle(method, p string, handler interface{}, middlewares ...Handler) Match(requestPath, method string) (*Route, Params) Router(p string, c interface{}, mappingMethods ...string) }
RouterInterface router interface
type Set ¶
type Set interface { String(key string) (string, error) Int(key string) (int, error) Int32(key string) (int32, error) Int64(key string) (int64, error) Uint(key string) (uint, error) Uint32(key string) (uint32, error) Uint64(key string) (uint64, error) Float32(key string) (float32, error) Float64(key string) (float64, error) Bool(key string) (bool, error) MustString(key string, defaults ...string) string MustEscape(key string, defaults ...string) string MustInt(key string, defaults ...int) int MustInt32(key string, defaults ...int32) int32 MustInt64(key string, defaults ...int64) int64 MustUint(key string, defaults ...uint) uint MustUint32(key string, defaults ...uint32) uint32 MustUint64(key string, defaults ...uint64) uint64 MustFloat32(key string, defaults ...float32) float32 MustFloat64(key string, defaults ...float64) float64 MustBool(key string, defaults ...bool) bool }
type StaticOptions ¶
type StaticOptions struct { RootPath string Prefix string IndexFiles []string ListDir bool FilterExts []string FileSystem http.FileSystem }
StaticOptions 静态文件选项
func (*StaticOptions) IsFilterExt ¶
func (s *StaticOptions) IsFilterExt(p string) bool
IsFilterExt 过滤文件
type StatusResult ¶
type StatusResult struct { Code int Result interface{} }
StatusResult describes http response
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
lib
|
|
logy
like https://gitea.com/lunny/log but made some adjustments
|
like https://gitea.com/lunny/log but made some adjustments |
nsq
//init pu,err:=NewProducer("192.168.0.197",4150) if err!=nil{ //error } b,_:=json.Marshal(obj) //发送 err = pu.Publish("topic",b) if err!=nil{ //error }
|
//init pu,err:=NewProducer("192.168.0.197",4150) if err!=nil{ //error } b,_:=json.Marshal(obj) //发送 err = pu.Publish("topic",b) if err!=nil{ //error } |
oauth/wechat
微信第三方登录相关 公众号支付相关 全局token相关 client:=NewClient(appId,secret) client.SetApiKey("支付的apiKey") ....
|
微信第三方登录相关 公众号支付相关 全局token相关 client:=NewClient(appId,secret) client.SetApiKey("支付的apiKey") .... |
pay/wepay
基础通讯业务实现 sam
|
基础通讯业务实现 sam |
redis
使用方法: 1.
|
使用方法: 1. |
util
AES CBC PKCS5Padding加/解密 使用 hex.Encode 查看测试文件: aes_cbc_test.go http client 使用github.com/imroc/req库 返回string,如果需要到struct,需要自己反序列化
|
AES CBC PKCS5Padding加/解密 使用 hex.Encode 查看测试文件: aes_cbc_test.go http client 使用github.com/imroc/req库 返回string,如果需要到struct,需要自己反序列化 |
from beego template link: github.com/astaxie/beego/fs.go from beego template link: github.com/astaxie/beego/template.go
|
from beego template link: github.com/astaxie/beego/fs.go from beego template link: github.com/astaxie/beego/template.go |