Documentation ¶
Index ¶
- Constants
- Variables
- func Abs[V kind.Number](value V) V
- func Acquire(lock *int64, timeout time.Duration) (token int64)
- func Base64Decode(src []byte) (dst []byte, err error)
- func Base64Decode2String(src []byte) (data string, err error)
- func Base64Encode(src []byte) []byte
- func Base64Encode2String(src []byte) string
- func Base64UrlDecode(src []byte) (dst []byte, err error)
- func Base64UrlEncode(src []byte) []byte
- func BigCamelByChar(str string, char byte) string
- func BinPath() string
- func Black(format string, args ...any)
- func Blue(format string, args ...any)
- func Bytes2Bool(data []byte) bool
- func Bytes2Float64(data []byte) float64
- func Bytes2Int16(data []byte) int16
- func Bytes2Int32(data []byte) int32
- func Bytes2Int64(data []byte) int64
- func Bytes2Int8(data []byte) int8
- func Bytes2JpgBytes(input []byte, quality int) ([]byte, error)
- func Bytes2String(data []byte) string
- func Bytes2Uint16(data []byte) uint16
- func Bytes2Uint32(data []byte) uint32
- func Bytes2Uint64(data []byte) uint64
- func Bytes2Uint8(data []byte) uint8
- func Bytes2WebpBytes(input []byte, quality float32) ([]byte, error)
- func Ceil[V kind.Number](value float64) V
- func CropThumbnailImage(img image.Image, width, height int) *image.RGBA
- func FetchFileSize(url, referer string) (fileSize int64, err error)
- func FileExists(fileName string) (exists bool, err error)
- func FileTime(fileName string) (createTime, lastAccessTime, lastWriteTime int64, err error)
- func FiveMinuteAxis() []string
- func Fuchsia(format string, args ...any)
- func Green(format string, args ...any)
- func HMac(key []byte, data []byte, hash crypto.Hash) string
- func HMacBytes(key []byte, data []byte, hash crypto.Hash) []byte
- func Hash(data []byte, hash crypto.Hash) string
- func HashBytes(data []byte, hash crypto.Hash) []byte
- func HashValue(key any) uint32
- func HexDecode(src []byte) (dst []byte, err error)
- func HexDecode2String(src []byte) (data string, err error)
- func HexEncode(src []byte) []byte
- func HexEncode2String(src []byte) string
- func Image2Webp(in, out string, quality float32) error
- func Index4Bit(key any, bitCount uint8) uint32
- func Index4Int16(key any) int16
- func Index4Int8(key any) int8
- func Index4Uint8(key any) uint8
- func Ip2Long(ip string) (ipVal uint32, err error)
- func Join[T kind.Integer](sep string, elems ...T) string
- func JsonDecode(data string, v any) (err error)
- func JsonEncode(v any) (data string, err error)
- func JsonUnmarshalFile(filePath string, v any) (err error)
- func LcFirst(str string) string
- func LocalIp() (ip string, err error)
- func Long2Ip(ipVal uint32) string
- func Markdown2Html(md []byte) []byte
- func Markdown2HtmlWithOption(md []byte, opts ...blackfriday.Option) []byte
- func Md5(data []byte) string
- func MinuteAxis() []string
- func MkDir(dir string, perm os.FileMode) (err error)
- func ParallelDown(fileName, url, referer string, fileSize int64, parallelSize int, ...) (err error)
- func ParallelLoad(loadList ...func() error)
- func PprofIsRun() bool
- func Recover(eventName string, f func(args ...any), args ...any)
- func Red(format string, args ...any)
- func RedFatal(format string, args ...any)
- func Release(lock *int64, token int64) (swapped bool)
- func Sha1(data []byte) string
- func Sha256(data []byte) string
- func SmallCamelByChar(str string, char byte) string
- func StartPprof(addr string, handler http.Handler) error
- func StopPprof(ctx context.Context) error
- func StopPprofWithTimeout(seconds int64) error
- func String2Bytes(data string) []byte
- func StringInteger[T kind.Integer](value T) string
- func Timeout(timeout time.Duration, handler func(args ...any), args ...any) error
- func ToString(val any) string
- func UcFirst(str string) string
- func YamlDecode(data string, v any) (err error)
- func YamlEncode(v any) (data string, err error)
- func YamlUnmarshalFile(filePath string, v any) (err error)
- func Yellow(format string, args ...any)
Constants ¶
View Source
const ( // OK 成功返回 OK = codes.OK // CodeCanceled 表示操作已取消(通常由调用者取消) CodeCanceled = codes.Canceled // CodeUnknown 未知错误 CodeUnknown = codes.Unknown // CodeInvalidArgument 客户端传递了一个无效的参数 CodeInvalidArgument = codes.InvalidArgument // CodeDeadlineExceeded 表示操作在完成前过期。对于改变系统状态的操作,即使操作成功完成,也可能会返回此错误。 // 例如,来自服务器的成功响应可能已延迟足够长的时间以使截止日期到期 CodeDeadlineExceeded = codes.DeadlineExceeded // CodeNotFound 表示未找到某些请求的实体(例如文件或目录) CodeNotFound = codes.NotFound // CodeAlreadyExists 表示创建实体的尝试失败,因为实体已经存在 CodeAlreadyExists = codes.AlreadyExists // CodePermissionDenied 表示调用者没有执行指定操作的权限 CodePermissionDenied = codes.PermissionDenied // CodeResourceExhausted 表示某些资源已用尽,可能是每个用户的配额,或者可能是整个文件系统空间不足 CodeResourceExhausted = codes.ResourceExhausted // CodeFailedPrecondition 操作被拒绝,因为系统未处于操作执行所需的状态。 // 例如,要删除的目录可能是非空的,rmdir 操作应用于非目录等 CodeFailedPrecondition = codes.FailedPrecondition // CodeAborted 操作已取消,通常是由于并发问题,如排序器检查失败、事务中止 CodeAborted = codes.Aborted // CodeOutRange 超出范围的操作 CodeOutRange = codes.OutOfRange // CodeUnimplemented 未实现或不支持的操作 CodeUnimplemented = codes.Unimplemented // CodeInternal 系统内部错误 CodeInternal = codes.Internal // 请注意,重试非幂等操作是不安全的 CodeUnavailable = codes.Unavailable // CodeDataLoss 表示不可恢复的数据丢失或损坏 CodeDataLoss = codes.DataLoss // CodeUnauthenticated 表示请求没有用于操作的有效身份验证凭据 CodeUnauthenticated = codes.Unauthenticated )
Variables ¶
View Source
var ( ErrFileSize = errors.New("file size error") ErrRequestFailed = errors.New("request failed") )
View Source
var ( ErrIpV4Address = errors.New(`invalid ip v4 address`) ErrNotFoundIp = errors.New("not found ip address") )
View Source
var ( JsonMarshal = json.Marshal JsonUnmarshal = json.Unmarshal )
View Source
var ( YamlMarshal = yaml.Marshal YamlUnmarshal = yaml.Unmarshal )
Functions ¶
func Base64Decode ¶
func Base64Decode2String ¶
func Base64Encode ¶
func Base64Encode2String ¶
func Base64UrlDecode ¶
func Base64UrlEncode ¶
func BigCamelByChar ¶ added in v2.0.9
func Bytes2JpgBytes ¶ added in v2.0.9
func Bytes2Uint16 ¶ added in v2.0.9
Bytes2Uint16 字节切片转换为uint16
func Bytes2WebpBytes ¶ added in v2.0.9
func CropThumbnailImage ¶ added in v2.0.9
func FetchFileSize ¶ added in v2.0.16
func FiveMinuteAxis ¶ added in v2.0.6
func FiveMinuteAxis() []string
func HexDecode2String ¶
func HexEncode2String ¶
func Image2Webp ¶ added in v2.0.9
func JsonUnmarshalFile ¶
JsonUnmarshalFile ---
func Markdown2Html ¶ added in v2.0.9
func Markdown2HtmlWithOption ¶ added in v2.0.9
func MinuteAxis ¶ added in v2.0.6
func MinuteAxis() []string
func ParallelDown ¶ added in v2.0.16
func ParallelLoad ¶
func ParallelLoad(loadList ...func() error)
func SmallCamelByChar ¶ added in v2.0.9
func StringInteger ¶
func YamlUnmarshalFile ¶
YamlUnmarshalFile ---
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.