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 FileCreate(content bytes.Buffer, name string)
- func FileMonitoringById(ctx context.Context, filePth string, id string, group string, ...)
- func GenerateMsgIDFromContext(c *gin.Context) string
- func GenerateRandomKey16() string
- func GenerateRandomKey20() string
- func GenerateRandomKey6() string
- func Get(url string) (string, error)
- func GetCurrentPath() string
- func GetCurrentTime() time.Time
- func GetCurrentTimeStr() string
- func GetFileSize(filename string) int64
- 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 IdsStrToIdsIntGroup(key string, c *gin.Context) []int
- func IdsStrToIdsIntGroupStr(keys string) []int
- func Int64ToString(e int64) string
- func IntToString(e int) string
- func Magenta(msg string) string
- func PathCreate(dir string) error
- func PathExist(addr string) bool
- func Post(url string, data interface{}, contentType string) ([]byte, error)
- 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 Translate(form, to interface{})
- func UIntToString(e uint) string
- func White(msg string) string
- func Yellow(msg string) string
- type Ids
- type Mode
- type ReplaceHelper
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 Assert ¶
Assert 条件断言 当断言条件为 假 时触发 panic 对于当前请求不会再执行接下来的代码,并且返回指定格式的错误信息和错误码
func FileMonitoringById ¶
func GenerateMsgIDFromContext ¶
GenerateMsgIDFromContext 生成msgID
func HasError ¶
HasError 错误断言 当 error 不为 nil 时触发 panic 对于当前请求不会再执行接下来的代码,并且返回指定格式的错误信息和错误码 若 msg 为空,则默认为 error 中的内容
func Post ¶
发送POST请求 url: 请求地址 data: POST请求提交的数据 contentType: 请求体格式,如:application/json content: 请求放回的内容
func SetPassword ¶
SetPassword 根据明文密码和加盐值生成密码
func Translate ¶
func Translate(form, to interface{})
Types ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.