Documentation ¶
Index ¶
- Constants
- func Assert(condition bool, msg string, code ...int)
- func Base64ToImage(imageBase64 string) ([]byte, error)
- func Black(msg string) string
- func Blue(msg string) string
- func CheckExist(src string) bool
- func CheckPermission(src string) bool
- func CompareHashAndPassword(e string, p string) (bool, error)
- func Crc16Hash(src string) string
- func Crc32Hash(src string) string
- func Crc8Hash(src string) string
- func CreateSubTable(f func(string) string)
- func Cyan(msg string) string
- func DynamicTable(f func(string) string, baseTable, fieldValue string) func(db *gorm.DB) *gorm.DB
- func ExecSql(db *gorm.DB, filePath string) error
- func FileCreate(content bytes.Buffer, name string, overwrite bool)
- func FileMonitoringById(ctx context.Context, filePth string, id string, group string, ...)
- func GenerateMsgIDFromContext(c *gin.Context) string
- func Get(url string) (string, error)
- func GetClientIP(c *gin.Context) string
- func GetCurrentPath() string
- func GetCurrentTime() time.Time
- func GetCurrentTimeStamp() int64
- func GetCurrentTimeStr() string
- func GetDirFiles(dir string) ([]string, error)
- func GetExt(fileName string) string
- func GetFileSize(filename string) int64
- func GetImgType(p string) (string, error)
- func GetLocaHonst() string
- func GetLocation(ip, key string) string
- func GetSize(f multipart.File) (int, error)
- func GetType(p string) (string, error)
- func GetUUID() string
- func Green(msg string) string
- func HasError(err error, msg string, code ...int)
- func Hmac(data string) string
- func Int64ToString(e int64) string
- func IntToString(e int) string
- func IsNotExistMkDir(src string) error
- func IsStringEmpty(str string) bool
- func Magenta(msg string) string
- func MkDir(src string) error
- func Open(name string, flag int, perm os.FileMode) (*os.File, error)
- func PathCreate(dir string) error
- func PathExist(addr string) bool
- func PathExists(path string) bool
- func Post(url string, data interface{}, contentType string) ([]byte, error)
- func Red(msg string) string
- func RemoveRepByMap(slc []string) []string
- func Round(f float64, n int) float64
- func SetColor(msg string, conf, bg, text int) string
- func StringToInt(e string) (int, error)
- func StructToJsonStr(e interface{}) (string, error)
- func Translate(form, to interface{})
- func UIntToString(e uint) string
- func White(msg string) string
- func Yellow(msg string) string
- type APIException
- type JSONDate
- type JSONTime
- type Mode
- type ReplaceHelper
- type WxCache
Constants ¶
View Source
const ( TextBlack = iota + 30 TextRed TextGreen TextYellow TextBlue TextMagenta TextCyan TextWhite )
View Source
const ( TrafficKey = "X-Request-Id" LoggerKey = "_kobh-logger-request" )
Variables ¶
This section is empty.
Functions ¶
func Base64ToImage ¶
func CreateSubTable ¶
func DynamicTable ¶
DynamicTable 动态表名 e.g. DB.Scopes(DynamicTable(Crc32Hash, "test", "小圈圈")).Find(&tests) 设置动态表名scope params: f 分表计算函数 baseTable 基础表名 fieldValue 参与分表字段
func FileMonitoringById ¶
func GenerateMsgIDFromContext ¶
GenerateMsgIDFromContext 生成msgID
func GetClientIP ¶
func GetCurrentTime ¶
func GetCurrentTimeStamp ¶
func GetCurrentTimeStamp() int64
func GetCurrentTimeStr ¶
func GetCurrentTimeStr() string
func GetDirFiles ¶
func HasError ¶
HasError 错误断言 当 error 不为 nil 时触发 panic 对于当前请求不会再执行接下来的代码,并且返回指定格式的错误信息和错误码 若 msg 为空,则默认为 error 中的内容
func Int64ToString ¶
func IntToString ¶
func IsStringEmpty ¶
func PathCreate ¶
func PathExists ¶
func Post ¶
发送POST请求 url: 请求地址 data: POST请求提交的数据 contentType: 请求体格式,如:application/json content: 请求放回的内容
func StringToInt ¶
func StructToJsonStr ¶
func UIntToString ¶
Types ¶
type APIException ¶
type APIException struct { Code int `json:"code"` Success bool `json:"success"` Msg string `json:"msg"` Timestamp int64 `json:"timestamp"` Result interface{} `json:"result"` }
api结构体
func ResponseJson ¶
func ResponseJson(message string, data interface{}, success bool) *APIException
200
type JSONTime ¶
JSONTime format json time field by myself
func (JSONTime) MarshalJSON ¶
MarshalJSON on JSONTime format Time field with %Y-%m-%d %H:%M:%S
func (*JSONTime) UnmarshalJSON ¶
type ReplaceHelper ¶
func (*ReplaceHelper) DoWrok ¶
func (h *ReplaceHelper) DoWrok() error
Click to show internal directories.
Click to hide internal directories.