Documentation
¶
Index ¶
- Variables
- func CamelString(name string) string
- func CreateDir(dirs ...string) (err error)
- func CustomTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)
- func GetWriteSyncer(file string) zapcore.WriteSyncer
- func PasswordHash(pwd string) (string, error)
- func PasswordVerify(hashedPwd string, sourcePwd string) bool
- func PathExists(path string) (bool, error)
- func SnakeString(name string) string
- func Struct2ColumnsValues(model interface{}, tag string) (columns []string, values []interface{})
- func Struct2Map(in interface{}, tagName string) (map[string]interface{}, error)
- func Struct2Slice(f interface{}) []string
- func Task(f TaskFunc, cb func(), params ...interface{})
- func Viper(path ...string) *viper.Viper
- func Zap() (logger *zap.Logger)
- type JSON
- type JSONTime
- type JWT
- func (j *JWT) CreateClaims(session jwtService.Session) jwtService.CustomSession
- func (j *JWT) CreateToken(claims jwtService.CustomSession) (string, error)
- func (j *JWT) CreateTokenByOldToken(oldToken string, claims jwtService.CustomSession) (string, error)
- func (j *JWT) ParseToken(tokenString string) (*jwtService.CustomSession, error)
- type Locker
- type TaskExecutor
- type TaskFunc
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CustomTimeEncoder ¶
func CustomTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)
自定义日志输出时间格式
func GetWriteSyncer ¶
func GetWriteSyncer(file string) zapcore.WriteSyncer
func PasswordHash ¶
* hash 加密密码 * @param string pwd 待加密的明文密码
func PasswordVerify ¶
* 验证 hash 密码 * @param string hashedPwd 已加密的hash密码 * @param string sourcePwd 确认密码
func PathExists ¶
func SnakeString ¶
*
- 驼峰转蛇形 snake string
- @description XxYy to xx_yy , XxYY to xx_y_y
- @date 2020/7/30
- @param s 需要转换的字符串
- @return string *
func Struct2ColumnsValues ¶
func Struct2Map ¶
ToMap 结构体转为Map[string]interface{}
func Struct2Slice ¶
func Struct2Slice(f interface{}) []string
Types ¶
type JSON ¶
type JSON []byte
func StructToJSON ¶
func StructToJSON(value interface{}) JSON
func (JSON) MarshalJSON ¶
func (*JSON) UnmarshalJSON ¶
type JWT ¶
type JWT struct {
SigningKey []byte
}
func (*JWT) CreateClaims ¶
func (j *JWT) CreateClaims(session jwtService.Session) jwtService.CustomSession
func (*JWT) CreateToken ¶
func (j *JWT) CreateToken(claims jwtService.CustomSession) (string, error)
创建一个token
func (*JWT) CreateTokenByOldToken ¶
func (j *JWT) CreateTokenByOldToken(oldToken string, claims jwtService.CustomSession) (string, error)
CreateTokenByOldToken 旧token 换新token 使用归并回源避免并发问题
func (*JWT) ParseToken ¶
func (j *JWT) ParseToken(tokenString string) (*jwtService.CustomSession, error)
解析 token
type TaskExecutor ¶
type TaskExecutor struct {
// contains filtered or unexported fields
}
func NewTaskExecutor ¶
func NewTaskExecutor(f TaskFunc, p []interface{}, callback func()) *TaskExecutor
func (*TaskExecutor) Exec ¶
func (t *TaskExecutor) Exec()
Click to show internal directories.
Click to hide internal directories.