Documentation ¶
Index ¶
- Constants
- Variables
- func Bool2Int(b bool) int
- func Byte2String(b []byte) string
- func CheckFileExist(filename string) bool
- func Excp(errString string) error
- func FileName(name, ext string) string
- func FilePath(name, ext string, escape bool) (string, error)
- func FileSize(filePath string) (int, bool, error)
- func Float642String(v float64, p int) string
- func GenEndHtml() (result string)
- func GenHLevelHtml(level int, startTag bool) (result string)
- func GenPageBreak() (result string)
- func GenPdf(buf *bytes.Buffer, fileName string) (err error)
- func GenStartHtml() (result string)
- func GetCurrentDirectory() string
- func GetMdHeader(level int) string
- func GetParentDirectory(directory string) string
- func GetParseParam(param string) string
- func Int2String(intval int) string
- func Int642String(intval int64) string
- func LimitLength(s string, length int) string
- func Mkdir(elem ...string) (string, error)
- func PathExists(path string) (bool, error)
- func SaveFile(name, content string) (err error)
- func StrToTime(s string) time.Time
- func StrToTimeUtc8(s string) time.Time
- func String2Float64(str string) (float64, error)
- func String2Int(str string) (int, error)
- func String2Int64(str string) (int64, error)
- func String2Uint(str string) uint
- func TimeToStr(t time.Time) string
- func Uint642String(intval uint64) string
- func UnmarshalJSON(data []byte, v interface{}) error
- func UnmarshalReader(r io.Reader, v interface{}) error
- func ValidateJSONTimeType(field reflect.Value) interface{}
- func WriteFileWithTrunc(filename, content string) (err error)
- type Controller
- type Errors
- type JSONTime
- type Model
Constants ¶
View Source
const TimeFormat = "2006-01-02 15:04:05"
View Source
const TimeZone = "Asia/Shanghai"
Variables ¶
View Source
var Errs = map[string]*Errors{
"ERR_UNKNOW_ERROR": {0, "未知系统错误"},
"ERR_NOERROR": {1, ""},
"SUCCESS": {1, ""},
"ERR_TOO_MANY_REQUEST": {429, "操作过于频繁, 请稍候再试"},
"ERR_CANNOT_OPERATION": {430, "不可执行此操作"},
"ERR_PARAM": {1000, "参数错误"},
"ERR_UNLOGIN": {1001, "请先注册登录"},
"ERR_INVALID_TOKEN": {1002, "无效的token"},
"ERR_UNAUTHORIZED": {1004, "您没有权限访问该数据"},
"ERR_DATA_DECODE": {1005, "数据解析失败"},
"ERR_HTTP_BASEURL": {1006, "请设置 baseurl"},
"ERR_TCP_TIMEOUT": {1504, "TCP接口响应超时"},
"ERR_HTTP_TIMEOUT": {1505, "HTTP接口响应超时"},
"ERR_MYSQL": {2000, "MySQL错误"},
"ERR_MYSQL_INSTALL_FAIL": {2001, "数据插入失败"},
"ERR_MYSQL_DELETE_FAIL": {2002, "数据删除失败"},
"ERR_MYSQLPOOL_FAIL": {2004, "mysql连接池丢失"},
"ERR_REDIS": {2100, "Reids错误"},
"ERR_REDISPOOL_FAIL": {2104, "redis连接池丢失"},
"ERR_IDGEN_FAIL": {2404, "id生成失败"},
}
Functions ¶
func CheckFileExist ¶
func GenEndHtml ¶
func GenEndHtml() (result string)
func GenHLevelHtml ¶
func GenPageBreak ¶
func GenPageBreak() (result string)
func GenStartHtml ¶
func GenStartHtml() (result string)
func GetCurrentDirectory ¶
func GetCurrentDirectory() string
func GetMdHeader ¶
func GetParentDirectory ¶
func GetParseParam ¶
func PathExists ¶
func StrToTimeUtc8 ¶
func String2Float64 ¶
String2Float64 string 转 float64
func Uint642String ¶
func UnmarshalJSON ¶
UnmarshalJSON 将 data 中的 json 格式的数据, 解析到 v
func UnmarshalReader ¶
UnmarshalReader 将 r 中的 json 格式的数据, 解析到 v
func ValidateJSONTimeType ¶
ValidateJSONTimeType gin 验证器 binding:"required"
func WriteFileWithTrunc ¶
Types ¶
type Controller ¶
type Controller struct { Ctx *gin.Context UserID int64 // UserInfo UserInfo Permission bool Jwt string Client string ClientID string AppName string AppVersion string AppID int Platform string PhoneModel string PhoneSysVersion string UmAliasType string UmDeviceToken string }
func NewController ¶
func NewController(ctx *gin.Context) (ctl *Controller)
func (*Controller) Error ¶
func (ctl *Controller) Error(e error, opt ...interface{})
func (*Controller) Success ¶
func (ctl *Controller) Success(result interface{})
type JSONTime ¶
JSONTime format json time field by myself
func (JSONTime) MarshalJSON ¶
MarshalJSON on JSONTime format Time field with Y-m-d H:i:s
func (*JSONTime) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.