Documentation ¶
Index ¶
- Constants
- Variables
- func CreateValidator()
- func GetAssetDir() string
- func GetConfigFile() string
- func GetDBFile() string
- func Log(lv LogLevel, content string)
- type Goploy
- type LogLevel
- type Response
- type Router
- func (rt *Router) Add(pattern, method string, callback func(gp *Goploy) *Response, ...) *Router
- func (rt *Router) Middleware(middleware func(gp *Goploy) error)
- func (rt *Router) Role(role string) *Router
- func (rt *Router) Roles(role []string) *Router
- func (rt *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (rt *Router) Start()
- func (rt *Router) White() *Router
Constants ¶
View Source
const ( Pass = 0 Deny = 1 Error = 2 )
response code
Variables ¶
View Source
var ( AssetDir string Gwg sync.WaitGroup )
View Source
var Trans ut.Translator
Trans Translator
View Source
var Validate *validator.Validate
Validate use a single instance of Validate, it caches struct info
Functions ¶
func GetAssetDir ¶
func GetAssetDir() string
GetAssetDir if env = 'production' return absolute else return relative
func GetConfigFile ¶ added in v1.2.0
func GetConfigFile() string
Types ¶
type Goploy ¶
type Goploy struct { Request *http.Request ResponseWriter http.ResponseWriter URLQuery url.Values Body []byte }
Goploy callback param
type Response ¶
type Response struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data"` }
Response struct
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is route slice and global middlewares
func (*Router) Add ¶
func (rt *Router) Add(pattern, method string, callback func(gp *Goploy) *Response, middleware ...func(gp *Goploy) error) *Router
Add router pattern path callback where path should be handled
func (*Router) Middleware ¶
Middleware global Middleware handle function
Click to show internal directories.
Click to hide internal directories.