Documentation
¶
Index ¶
- Constants
- Variables
- func AuthRequest(disUrls ...string) gin.HandlerFunc
- func EncodeMsg(msg Msg) (body []byte, err error)
- func I18N(args ...string) gin.HandlerFunc
- func LoadLocales(dir string) error
- func NewContext() gin.HandlerFunc
- func NewSession(opt ...session.Option) gin.HandlerFunc
- func StructToString(data interface{}) string
- func Tr(format string, args ...interface{}) string
- type Context
- func (c *Context) AuthFailed()
- func (c *Context) Clear()
- func (c *Context) Data() (data map[interface{}]interface{})
- func (c *Context) DataTable(draw, total, datas interface{}) G
- func (c *Context) Delete(key string)
- func (c *Context) Get(key string) (interface{}, bool)
- func (c *Context) HMessage(code int, url, message string, v ...interface{})
- func (c *Context) JMessage(code int, url, message string, v ...interface{})
- func (c *Context) ParamDefault(key, defaultValue string) string
- func (c *Context) ParamInt64Default(key string, defaultValue int64) int64
- func (c *Context) QueryInt64Default(key string, defaultValue int64) int64
- func (c *Context) QueryIntDefault(key string, defaultValue int) int
- func (c *Context) ReadRequest(body interface{}) (req *Request, err error)
- func (c *Context) SessClear() error
- func (c *Context) SessDelete(key string) interface{}
- func (c *Context) SessGet(key string, value interface{}) (err error)
- func (c *Context) SessGetValue(key string) (interface{}, bool)
- func (c *Context) SessSave()
- func (c *Context) SessSet(key string, value interface{})
- func (c *Context) Session() session.Store
- func (c *Context) Set(key string, value interface{})
- func (c *Context) WriteResponse(code int, body interface{}, message string, v ...interface{})
- type G
- type Msg
- type ReqHeader
- type Request
- type Response
Constants ¶
View Source
const (
DefaultKey = "github.com/forease/gin-middleware"
)
Variables ¶
View Source
var (
DefaultLang = "zh_CN"
)
Functions ¶
func AuthRequest ¶
func AuthRequest(disUrls ...string) gin.HandlerFunc
setup not need check authorize URL
urls := []string{"/login", "/users", "/firewall"}
router.Use(middleware.AuthRequest(urls...))
func I18N ¶
func I18N(args ...string) gin.HandlerFunc
func LoadLocales ¶
func StructToString ¶
func StructToString(data interface{}) string
StructToString convert struct to string
Types ¶
type Context ¶
Context -
func (*Context) AuthFailed ¶
func (c *Context) AuthFailed()
AuthFailed write auth failed message to client
func (*Context) ParamDefault ¶
ParamDefault -
func (*Context) QueryInt64Default ¶
QueryInt64Default -
func (*Context) ReadRequest ¶
ReadRequest read client's json data
func (*Context) SessGetValue ¶
SessGetValue -
func (*Context) WriteResponse ¶
WriteResponse write json to client
type Msg ¶
type Request ¶
type Request struct {
Header ReqHeader // request header
Body interface{} // body
}
Request -
func RequestReader ¶
func RequestReader(input io.ReadCloser, body interface{}) (req *Request, err error)
RequestReader read request data
Click to show internal directories.
Click to hide internal directories.