Documentation ¶
Index ¶
- Constants
- Variables
- func DbCreate(dataSourceName string, showSQL bool) *sqlx.DB
- func DbExecuteCountManyContent(ctx context.Context, tx DbExeAble, query string, n int, args ...interface{}) (int64, error)
- func DbExecuteCountNamedContent(ctx context.Context, tx DbExeAble, query string, argMap map[string]interface{}) (int64, error)
- func DbExecuteLastIDNamedContent(ctx context.Context, tx DbExeAble, query string, argMap map[string]interface{}) (int64, error)
- func DbGetNamedContent(ctx context.Context, tx DbExeAble, dest interface{}, query string, ...) (bool, error)
- func DbSelectNamedContent(ctx context.Context, tx DbExeAble, dest interface{}, query string, ...) error
- func DecodeHashID(salt string, minLen int, value string) (int, error)
- func DecodeHashIDs(salt string, minLen int, value string) ([]int, error)
- func EncodeHashID(salt string, minLen, id int) (string, error)
- func EncodeHashIDs(salt string, minLen int, ids []int) (string, error)
- func GetUUIDStr() string
- func GinDoRespErr(c *gin.Context, code int64, msg string, data gin.H)
- func GinDoRespInternalErr(c *gin.Context)
- func GinDoRespSuccess(c *gin.Context, data gin.H)
- func GinFillBindError(c *gin.Context, err error)
- func GinRepeatReadBody(c *gin.Context) error
- func GinShouldBindRepeat(c *gin.Context, obj interface{}) error
- func IntArrToString(A []int64, delim string) string
- func IsIntInSlice(arr []int64, str int64) bool
- func IsStringInSlice(arr []string, str string) bool
- func LogSetLevel(level zapcore.Level) error
- func LogSetToProd() error
- func QiniuGetDownloadURL(ctx context.Context, access string, secret string, domain string, ...) string
- func TencenSms(sdkID, sdkKey, appID, sign, templateID string, tels []string, ...) error
- func UploadToQiniu(ctx context.Context, access string, secret string, zone *storage.Zone, ...) error
- type DbExeAble
- type GinResp
- type LoggerAble
Constants ¶
View Source
const ( // ErrorSuccess 成功 ErrorSuccess = 0 // ErrorSuccessMsg 成功 ErrorSuccessMsg = "success" // ErrorInternal 内部错误 ErrorInternal = -1 // ErrorInternalMsg 内部错误 ErrorInternalMsg = "internal" // ErrorBind 输入绑定错误 ErrorBind = -2 // ErrorBindMsg 输入绑定错误 ErrorBindMsg = "input bind" )
Variables ¶
View Source
var GinRespInternalErr = GinResp{ ErrCode: ErrorInternal, ErrMsg: ErrorInternalMsg, }
GinRespInternalErr 成功返回
View Source
var GinRespSuccess = GinResp{ ErrCode: ErrorSuccess, ErrMsg: ErrorSuccessMsg, }
GinRespSuccess 成功返回
View Source
var ZapLog *zap.Logger
ZapLog zap日志对象
Functions ¶
func DbExecuteCountManyContent ¶
func DbExecuteCountManyContent(ctx context.Context, tx DbExeAble, query string, n int, args ...interface{}) (int64, error)
DbExecuteCountManyContent 返回sql语句并返回执行行数
func DbExecuteCountNamedContent ¶
func DbExecuteCountNamedContent(ctx context.Context, tx DbExeAble, query string, argMap map[string]interface{}) (int64, error)
DbExecuteCountNamedContent 执行sql语句返回执行个数
func DbExecuteLastIDNamedContent ¶
func DbExecuteLastIDNamedContent(ctx context.Context, tx DbExeAble, query string, argMap map[string]interface{}) (int64, error)
DbExecuteLastIDNamedContent 执行sql语句并返回lastID
func DbGetNamedContent ¶
func DbGetNamedContent(ctx context.Context, tx DbExeAble, dest interface{}, query string, argMap map[string]interface{}) (bool, error)
DbGetNamedContent 执行sql查询并返回当个元素
func DbSelectNamedContent ¶
func DbSelectNamedContent(ctx context.Context, tx DbExeAble, dest interface{}, query string, argMap map[string]interface{}) error
DbSelectNamedContent 执行sql查询并返回多行
func DecodeHashID ¶ added in v0.1.10
DecodeHashID 解析hash id
func DecodeHashIDs ¶ added in v0.1.13
DecodeHashIDs 解析hash id
func EncodeHashID ¶ added in v0.1.10
EncodeHashID 获取hash id
func EncodeHashIDs ¶ added in v0.1.13
EncodeHashIDs 获取hash id
func GinDoRespErr ¶ added in v0.1.9
GinDoRespErr 返回特殊错误
func GinDoRespSuccess ¶ added in v0.1.9
GinDoRespSuccess 返回成功信息
func GinFillBindError ¶
GinFillBindError 检测gin输入绑定错误
func GinShouldBindRepeat ¶ added in v0.1.3
GinShouldBindRepeat 可重复绑定参数
func IntArrToString ¶ added in v0.1.17
IntArrToString 数组转换
func IsStringInSlice ¶
IsStringInSlice 字符串是否在数组中
func QiniuGetDownloadURL ¶ added in v0.1.12
func QiniuGetDownloadURL(ctx context.Context, access string, secret string, domain string, fileKey string, deadline int64) string
QiniuGetDownloadURL 获取私有下载链接
Types ¶
type DbExeAble ¶
type DbExeAble interface { Rebind(string) string Get(dest interface{}, query string, args ...interface{}) error Exec(query string, args ...interface{}) (sql.Result, error) Select(dest interface{}, query string, args ...interface{}) error GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error }
DbExeAble 数据库接口
type GinResp ¶ added in v0.1.5
type GinResp struct { ErrCode int64 `json:"error"` ErrMsg string `json:"error_msg"` Data gin.H `json:"data,omitempty"` }
func GinFillSuccessData ¶ added in v0.1.8
GinFillSuccessData 填充返回数据
type LoggerAble ¶
type LoggerAble interface { Debugf(template string, args ...interface{}) Infof(template string, args ...interface{}) Warnf(template string, args ...interface{}) Errorf(template string, args ...interface{}) Fatalf(template string, args ...interface{}) }
LoggerAble 日志对象接口
var Log LoggerAble
Log 对外服务的日志对象
Click to show internal directories.
Click to hide internal directories.