Documentation
¶
Index ¶
- Constants
- func DeJSONalizeStr(s string, v any) error
- func DelayDo(d time.Duration, fn func())
- func GetNextColor() color
- func Hold()
- func IsDev() bool
- func IsDigits(s string) bool
- func IsNil[T any](v T) bool
- func JSONalizeStr(v any) string
- func LogMessage(message string)
- func PPrettyPrint(v any)
- func PPrint(obj interface{})
- func PrettyObjStr(v any) string
- func PrintlnColor(c color, text string)
- func RetryWork(work func() (any, error), retryTimes int) (any, error)
- func TimeoutWork(work func() (any, error), timeout time.Duration) (any, error)
Constants ¶
View Source
const ( Red color = iota Green BrightBlue Magenta // 紫色 Cyan // 青色 )
Variables ¶
This section is empty.
Functions ¶
func DeJSONalizeStr ¶ added in v0.31.0
DeJSONalizeStr 将 JSON 字符串解码到 v 指向的值中。 v 必须是非 nil 的指针,否则返回 error。
func GetNextColor ¶ added in v0.18.0
func GetNextColor() color
func IsNil ¶ added in v0.19.0
IsNil returns true if v is a nil value for nilable kinds or an untyped nil interface.
func JSONalizeStr ¶ added in v0.31.0
JSONalizeStr 尝试将任意对象编码为漂亮的 JSON 字符串;若 JSON 编码失败,则回退到 PrettyObjStr。
func LogMessage ¶
func LogMessage(message string)
func PPrettyPrint ¶ added in v0.31.0
func PPrettyPrint(v any)
PPrettyPrint 使用 spew 打印任意对象(更接近 Python pprint)
func PrettyObjStr ¶ added in v0.31.0
PrettyObjStr 返回对象的漂亮字符串表示(不打印,供日志/前端返回)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.