Documentation ¶
Index ¶
- Variables
- func ExportCsv(ctx *beegoContext.Context, title []string, dataList [][]string, ...) error
- func ExportExcel(w http.ResponseWriter, r *http.Request, titleList []string, ...)
- func InitValidate()
- func Valid(obj interface{}, validate interface{}) (error string)
- type Content
- type Context
- func (ctx *Context) JsonParams(params map[string]interface{})
- func (ctx *Context) OtuPut(code int, data []byte)
- func (ctx *Context) OtuPutHtml(code int, html string)
- func (ctx *Context) OtuPutJson(code int, obj interface{})
- func (ctx *Context) OtuPutString(code int, format string, values ...interface{})
- func (ctx *Context) PostForm(key string) string
- func (ctx *Context) Query(key string) string
- func (ctx *Context) SetHeader(key string, value string)
- func (ctx *Context) SetStatus(code int)
- type ReturnMsg
Constants ¶
This section is empty.
Variables ¶
var MessageTemples = map[string]string{
"Required": "不能为空",
"Min": "最小为%d",
"Max": "最大为%d",
"Range": "范围在%d至%d",
"MinSize": "最小长度为%d",
"MaxSize": "最大长度为%d",
"Length": "长度必须是%d",
"Alpha": "必须是有效的字母字符",
"Numeric": "必须是有效的数字字符",
"AlphaNumeric": "必须是有效的字母或数字字符",
"Match": "必须匹配格式%s",
"NoMatch": "必须不匹配格式%s",
"AlphaDash": "必须是有效的字母或数字或破折号(-_)字符",
"Email": "必须是有效的邮件地址",
"IP": "必须是有效的IP地址",
"Base64": "必须是有效的base64字符",
"Mobile": "必须是有效手机号码",
"Tel": "必须是有效电话号码",
"Phone": "必须是有效的电话号码或者手机号码",
"ZipCode": "必须是有效的邮政编码",
}
MessageTemples 错误提示模板
Functions ¶
func ExportCsv ¶
func ExportCsv(ctx *beegoContext.Context, title []string, dataList [][]string, fileName string) error
ExportCsv 数据导出CSV @param ctx *beegoContext.Context @param title []string @param dataList [][]string @param fileName string @return error
func ExportExcel ¶
func ExportExcel(w http.ResponseWriter, r *http.Request, titleList []string, dataList [][]interface{}, fileName string)
ExportExcel 数据导出excel @param w http.ResponseWriter @param r *http.Request @param titleList []string @param dataList [][]interface{} @param fileName string
Types ¶
type Context ¶
type Context struct { Writer *beegoContext.Response Req *beegoContext.Context Path string Method string StatusCode int }
Context 上下文结构
func NewContext ¶
func NewContext(ctx *beegoContext.Context) *Context
NewContext 创建新的上下文 @param ctx *beegoContext.Context @return *Context
func (*Context) JsonParams ¶
JsonParams 接收application/json请求头的请求参数 @receiver ctx *Context @param params map[string]interface{}
func (*Context) OtuPutHtml ¶
OtuPutHtml 输出HTML响应 @receiver ctx *Context @param code int @param html string
func (*Context) OtuPutJson ¶
OtuPutJson 输出json @receiver ctx *Context @param code int @param obj interface{}
func (*Context) OtuPutString ¶
OtuPutString 输出字符串 @receiver ctx *Context @param code int @param format string @param values ...interface{}
func (*Context) PostForm ¶
PostForm 获取post表单参数 @receiver ctx *Context @param key string @return string