Documentation ¶
Index ¶
- Constants
- func Assert(condition bool, msg string, code ...int)
- func Black(msg string) string
- func Blue(msg string) string
- func CompareHashAndPassword(e string, p string) (bool, error)
- func Cyan(msg string) string
- func GenerateMsgIDFromContext(c *gin.Context) string
- func GenerateRandomKey(length int) string
- func GetCurrentTime() time.Time
- func GetCurrentTimeStr() string
- func GetLocaHonst() string
- func GetLocation(ip, key string) string
- func GetOrm(c *gin.Context) (*gorm.DB, error)
- func Green(msg string) string
- func HasError(err error, msg string, code ...int)
- func Int64ToString(e int64) string
- func IntToString(e int) string
- func Magenta(msg string) string
- func Red(msg string) string
- func Round(f float64, n int) float64
- func SetColor(msg string, conf, bg, text int) string
- func SetPassword(password string, salt string) (verify string, err error)
- func StringToInt(e string) (int, error)
- func StructToJsonStr(e interface{}) (string, error)
- func UIntToString(e uint) string
- func White(msg string) string
- func Yellow(msg string) string
Constants ¶
View Source
const ( TextBlack = iota + 30 TextRed TextGreen TextYellow TextBlue TextMagenta TextCyan TextWhite )
View Source
const ( TrafficKey = "X-Request-Id" LoggerKey = "_go-admin-logger-request" )
Variables ¶
This section is empty.
Functions ¶
func GenerateMsgIDFromContext ¶
GenerateMsgIDFromContext 生成msgID
func GetCurrentTime ¶
func GetCurrentTimeStr ¶
func GetCurrentTimeStr() string
func HasError ¶
HasError 错误断言 当 error 不为 nil 时触发 panic 对于当前请求不会再执行接下来的代码,并且返回指定格式的错误信息和错误码 若 msg 为空,则默认为 error 中的内容
func Int64ToString ¶
func IntToString ¶
func SetPassword ¶
SetPassword 根据明文密码和加盐值生成密码
func StringToInt ¶
func StructToJsonStr ¶
func UIntToString ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.