Documentation ¶
Index ¶
- Variables
- func ListenAndServe(addr string, route *Router)
- func Run()
- func SetStaticPath(static string)
- func SetTemplateSuffix(suffix string)
- func SetViewsPath(view string)
- type Controller
- func (controller *Controller) After()
- func (controller *Controller) Before()
- func (controller *Controller) GetBool(key string) bool
- func (controller *Controller) GetCookie(key string) []byte
- func (controller *Controller) GetCookieString(key string) string
- func (controller *Controller) GetCtxFloat64(key string, def float64) (float64, error)
- func (controller *Controller) GetFile(key string) (*multipart.FileHeader, error)
- func (controller *Controller) GetInt(key string, def int) (int, error)
- func (controller *Controller) GetInt16(key string, def int16) (int16, error)
- func (controller *Controller) GetInt32(key string, def int32) (int32, error)
- func (controller *Controller) GetInt64(key string, def int64) (int64, error)
- func (controller *Controller) GetInt8(key string, def int8) (int8, error)
- func (controller *Controller) GetString(key string, def string) string
- func (controller *Controller) GetUInt16(key string, def uint16) (uint16, error)
- func (controller *Controller) GetUInt32(key string, def uint32) (uint32, error)
- func (controller *Controller) GetUInt64(key string, def uint64) (uint64, error)
- func (controller *Controller) GetUInt8(key string, def uint8) (uint8, error)
- func (controller *Controller) Init(ctx *fasthttp.RequestCtx, controllerName string, actionName string)
- func (controller *Controller) IsAjax() bool
- func (controller *Controller) LayoutRender(layout string, tpl string)
- func (controller *Controller) Render(tpl string)
- func (controller *Controller) ReturnError(status int, message string)
- func (controller *Controller) ReturnJson(body interface{})
- func (controller *Controller) SetCookie(name string, value string, others ...interface{})
- func (controller *Controller) Static()
- func (controller *Controller) UserAgent() string
- type ControllerInterface
- type Router
- func (r *Router) Add(requestMethod, path string, controller ControllerInterface, action string)
- func (r *Router) DELETE(path string, controller ControllerInterface, action string)
- func (r *Router) GET(path string, controller ControllerInterface, action string)
- func (r *Router) HEAD(path string, controller ControllerInterface, action string)
- func (r *Router) OPTIONS(path string, controller ControllerInterface, action string)
- func (r *Router) PATCH(path string, controller ControllerInterface, action string)
- func (r *Router) POST(path string, controller ControllerInterface, action string)
- func (r *Router) PUT(path string, controller ControllerInterface, action string)
- func (r *Router) Request(requestMethod, path string, controller ControllerInterface, action string)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Version = "v0.1" Conf = viper.New() Log = go_logger.NewLogger() AppPath = "" RootPath = "" ViewPath = "" StaticPath = "" TemplateSuffix = ".html" Session = fasthttpsession.NewSession(fasthttpsession.NewDefaultConfig()) Route = NewRouter() )
Functions ¶
func ListenAndServe ¶
func SetStaticPath ¶
func SetStaticPath(static string)
func SetTemplateSuffix ¶
func SetTemplateSuffix(suffix string)
func SetViewsPath ¶
func SetViewsPath(view string)
Types ¶
type Controller ¶
type Controller struct { Ctx *fasthttp.RequestCtx ControllerName string ActionName string Data map[string]interface{} Session fasthttpsession.SessionStore }
func NewController ¶
func NewController() *Controller
func (*Controller) GetBool ¶
func (controller *Controller) GetBool(key string) bool
get request ctx bool
func (*Controller) GetCookie ¶
func (controller *Controller) GetCookie(key string) []byte
func (*Controller) GetCookieString ¶
func (controller *Controller) GetCookieString(key string) string
func (*Controller) GetCtxFloat64 ¶
func (controller *Controller) GetCtxFloat64(key string, def float64) (float64, error)
get request content text float64
func (*Controller) GetFile ¶
func (controller *Controller) GetFile(key string) (*multipart.FileHeader, error)
get form file by key
func (*Controller) GetInt ¶
func (controller *Controller) GetInt(key string, def int) (int, error)
get request ctx int
func (*Controller) GetInt16 ¶
func (controller *Controller) GetInt16(key string, def int16) (int16, error)
get request ctx int16
func (*Controller) GetInt32 ¶
func (controller *Controller) GetInt32(key string, def int32) (int32, error)
get request ctx int32
func (*Controller) GetInt64 ¶
func (controller *Controller) GetInt64(key string, def int64) (int64, error)
get request ctx int64
func (*Controller) GetInt8 ¶
func (controller *Controller) GetInt8(key string, def int8) (int8, error)
get request ctx int8
func (*Controller) GetString ¶
func (controller *Controller) GetString(key string, def string) string
get request ctx string
func (*Controller) GetUInt16 ¶
func (controller *Controller) GetUInt16(key string, def uint16) (uint16, error)
get request ctx uint16
func (*Controller) GetUInt32 ¶
func (controller *Controller) GetUInt32(key string, def uint32) (uint32, error)
get request ctx uint32
func (*Controller) GetUInt64 ¶
func (controller *Controller) GetUInt64(key string, def uint64) (uint64, error)
get request ctx uint64
func (*Controller) GetUInt8 ¶
func (controller *Controller) GetUInt8(key string, def uint8) (uint8, error)
get request ctx uint8
func (*Controller) Init ¶
func (controller *Controller) Init(ctx *fasthttp.RequestCtx, controllerName string, actionName string)
init controller
func (*Controller) LayoutRender ¶
func (controller *Controller) LayoutRender(layout string, tpl string)
layout render view response
func (*Controller) ReturnError ¶
func (controller *Controller) ReturnError(status int, message string)
return error
func (*Controller) ReturnJson ¶
func (controller *Controller) ReturnJson(body interface{})
return json
func (*Controller) SetCookie ¶
func (controller *Controller) SetCookie(name string, value string, others ...interface{})
func (*Controller) UserAgent ¶
func (controller *Controller) UserAgent() string
type ControllerInterface ¶
type ControllerInterface interface { Init(ctx *fasthttp.RequestCtx, controllerName string, actionName string) Before() After() }
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) Add ¶
func (r *Router) Add(requestMethod, path string, controller ControllerInterface, action string)
func (*Router) DELETE ¶
func (r *Router) DELETE(path string, controller ControllerInterface, action string)
DELETE Request
func (*Router) GET ¶
func (r *Router) GET(path string, controller ControllerInterface, action string)
GET Request
func (*Router) HEAD ¶
func (r *Router) HEAD(path string, controller ControllerInterface, action string)
HEAD Request
func (*Router) OPTIONS ¶
func (r *Router) OPTIONS(path string, controller ControllerInterface, action string)
OPTIONS Request
func (*Router) PATCH ¶
func (r *Router) PATCH(path string, controller ControllerInterface, action string)
PATCH Request
func (*Router) POST ¶
func (r *Router) POST(path string, controller ControllerInterface, action string)
POST Request
Click to show internal directories.
Click to hide internal directories.