Documentation
¶
Index ¶
- Variables
- func JWT() *_JwtLoginPlugin
- func SetConfigSuffix(suffix string) *_SetConfigSuffixPlugin
- func Silent(url ...string) *_SilenceSetter
- func StandardJsonWrapper(arguments ...StandardJsonWrapperSetter) render.Render
- func StdError(code int, msg string) error
- func WrapError(code int, err error) error
- type DataNotWrapper
- type DelimSetter
- type Html5Router
- type JsonError
- type JsonErrorRender
- type PageRedirector
- type StandardErrorOrData
- type StandardJsonWrapperSetter
- type User
- type UserModule
Constants ¶
This section is empty.
Variables ¶
var JSON = new(_JSONPlugin)
JSON standard JSON plugin JSON 标准JSON服务器 Usage: goblet.Organize("server-name", plugin.JSON)
var LoginInHead = new(_loginInHead)
Functions ¶
func JWT ¶
func JWT() *_JwtLoginPlugin
New create a new LoginAsJwt plugin, secret is the secret key for jwt, idKey is the key for id in jwt
func SetConfigSuffix ¶
func SetConfigSuffix(suffix string) *_SetConfigSuffixPlugin
func StandardJsonWrapper ¶
func StandardJsonWrapper(arguments ...StandardJsonWrapperSetter) render.Render
StandardJsonWrapper return a standard json wrapper StandardJsonWrapper 返回一个标准的json包装器 使用方法: 调用plugin.StandardJsonWrapper()作为参数传入Organize函数 successCode: the code of success successMsg: the message of success
Types ¶
type DataNotWrapper ¶
type DataNotWrapper interface {
// ShouldNotWrap 是否不应该被包装
ShouldNotWrap() bool
}
type DelimSetter ¶
type DelimSetter struct {
// contains filtered or unexported fields
}
func NewDelimSetter ¶
func NewDelimSetter(strs ...string) *DelimSetter
func (*DelimSetter) SetDelim ¶
func (d *DelimSetter) SetDelim() [2]string
type Html5Router ¶
type Html5Router struct {
goblet.Route `/`
goblet.Render `html=/`
goblet.GroupController
// contains filtered or unexported fields
}
func Html5RoutePages ¶
func Html5RoutePages(include []string, excluded ...[]string) *Html5Router
type JsonError ¶
type JsonError struct {
}
JsonError mark a type as an error which should be used as Json, you can implement a type with RespondAsJson() bool function and respond true or just inherbit JsonError type
func (JsonError) RespondAsJson ¶
type JsonErrorRender ¶
type JsonErrorRender interface {
RespondAsJson() bool
}
type PageRedirector ¶
type PageRedirector struct {
goblet.Route `/`
goblet.Render `html`
goblet.GroupController
// contains filtered or unexported fields
}
func PageRedirect ¶
func PageRedirect(matcher *regexp.Regexp, target string, withOriginalAsQuery bool) *PageRedirector
PageRedirect Create a page redirector match the matcher and redirect to target, if withOriginalAsQuery is true, the original url will be append to the target url's query part as target?original=original
type StandardErrorOrData ¶
type StandardErrorOrData struct {
Data interface{} `json:"data,omitempty"`
Msg string `json:"msg"`
Code int `json:"code"`
}
func (*StandardErrorOrData) Error ¶
func (s *StandardErrorOrData) Error() string
type StandardJsonWrapperSetter ¶
type StandardJsonWrapperSetter func(*jsonRenderWrapper)
StandardJsonWrapperSetter set the success code and message StandardJsonWrapperSetter 设置成功的代码和消息
func SjwWithSuccessCode ¶
func SjwWithSuccessCode(code int) StandardJsonWrapperSetter
func SjwWithSuccessMsg ¶
func SjwWithSuccessMsg(msg string) StandardJsonWrapperSetter