Documentation ¶
Index ¶
- Constants
- Variables
- func AESECBDecrypt(encrypted []byte, key []byte) (decrypted []byte)
- func AESECBEncrypt(src []byte, key []byte) (encrypted []byte)
- func AesCBCDecrypt(cryted string, key string) string
- func AesCBCEncrypt(orig string, key string) string
- func Async[M any](process int, push func(c chan M), logic func(M))
- func CachePanic()
- func CachePanicWithHandle(handle func(err interface{}))
- func CamelToSnake(s string) string
- func CopyFile(src, dst string) error
- func DialTimeout(network, addr string, timeout time.Duration) (time.Duration, error)
- func DiffSlice(a interface{}, b interface{}) (interface{}, interface{})
- func Exit()
- func FileAppend(filename string, content string) error
- func FileExists(path string) bool
- func FileRead(filename string) (content []byte, err error)
- func FileReadByLine(fileName string, logic func(line string) error) error
- func FileReadWithFs(filename string, fsys fs.FS) (content []byte, err error)
- func FileWrite(filename string, content string) error
- func FormatDuration(d time.Duration) string
- func FormatTime(t time.Time) string
- func GenGpg() (*pgp.PGPKeyPair, error)
- func GetConfigDir() string
- func GetErrCode(err error) int32
- func GetExecPath() string
- func GetExitSign() chan os.Signal
- func GetFileModTime(path string) time.Time
- func GetPwd() string
- func GetUserConfigDir() string
- func GetUserHomeDir() string
- func GpgDecrypt(privKey, pubKey string, msg []byte) ([]byte, error)
- func GpgEncrypt(pubKey string, msg string) ([]byte, error)
- func HmacMd5(key, data string) string
- func HmacSha224(key, data string) string
- func HmacSha256(key, data string) string
- func HmacSha384(key, data string) string
- func HmacSha512(key, data string) string
- func Int2Ip(ip int64) net.IP
- func Ip2Int(ipStr string) int64
- func IsDir(path string) bool
- func IsFile(path string) bool
- func IsIp(ip string) bool
- func IsIpV4(ip string) bool
- func IsIpV6(ip string) bool
- func IsLocalIp(ip string) bool
- func KeyBy(list interface{}, fieldName string) interface{}
- func MapKeysString(m interface{}) []string
- func MapValues(m interface{}) interface{}
- func Md5(s string) string
- func MergeCIDRs(cidrs []string) ([]string, error)
- func MergeIPNets(nets []*net.IPNet) ([]*net.IPNet, error)
- func Now() uint32
- func PKCS7Padding(ciphertext []byte, blocksize int) []byte
- func PKCS7UnPadding(origData []byte) []byte
- func PluckInt(list interface{}, fieldName string) []int
- func PluckInt32(list interface{}, fieldName string) []int32
- func PluckInt64(list interface{}, fieldName string) []int64
- func PluckString(list interface{}, fieldName string) []string
- func PluckStringSlice(list interface{}, fieldName string) [][]string
- func PluckUint32(list interface{}, fileName string) []uint32
- func PluckUint64(list interface{}, fieldName string) []uint64
- func PrintStack()
- func ProcessBarAscii(total, done int64, wight int64) string
- func RandDuration(min time.Duration, max time.Duration) time.Duration
- func RandSleep(min time.Duration, max time.Duration)
- func RandStringLetter(n int) string
- func RandStringWithSeed(n int, seed []rune) string
- func RealIpFromFiberCtx(ctx *fiber.Ctx) string
- func RemoveSlice(src interface{}, rm interface{}) interface{}
- func Scan(src interface{}, dst interface{}) error
- func Sha224(s string) string
- func Sha256(s string) string
- func Sha384(s string) string
- func Sha512(s string) string
- func ShortStr(str string, max int) string
- func ShortStr4Web(str string, max int) string
- func Slice2Map[M constraints.Ordered](list []M) map[M]bool
- func SnakeToCamel(s string) string
- func TCPPing(address string) (time.Duration, error)
- func ToBool(val interface{}) bool
- func ToFloat32(val interface{}) float32
- func ToFloat64(val interface{}) float64
- func ToFloat64Slice(val interface{}) []float64
- func ToInt(val interface{}) int
- func ToInt16(val interface{}) int16
- func ToInt32(val interface{}) int32
- func ToInt64(val interface{}) int64
- func ToInt64Slice(val interface{}) []int64
- func ToInt8(val interface{}) int8
- func ToString(val interface{}) string
- func ToUint(val interface{}) uint
- func ToUint16(val interface{}) uint16
- func ToUint32(val interface{}) uint32
- func ToUint64(val interface{}) uint64
- func ToUint8(val interface{}) uint8
- func UDPPing(address string) (time.Duration, error)
- func Utf16KLen(str string) int
- func Validate(m interface{}) error
- func Value(m interface{}) (driver.Value, error)
- func WaitExist()
- type ContentType
- type Error
- type Map
- func (p *Map) Clone() *Map
- func (p *Map) DisableCut() *Map
- func (p *Map) EnableCut(seq string) *Map
- func (p *Map) Exists(key string) bool
- func (p *Map) Get(key string) (interface{}, error)
- func (p *Map) GetBool(key string) bool
- func (p *Map) GetBytes(key string) []byte
- func (p *Map) GetFloat64(key string) float64
- func (p *Map) GetInt(key string) int
- func (p *Map) GetInt32(key string) int32
- func (p *Map) GetInt64(key string) int64
- func (p *Map) GetInt64Slice(key string) []int64
- func (p *Map) GetMap(key string) *Map
- func (p *Map) GetSlice(key string) []interface{}
- func (p *Map) GetString(key string) string
- func (p *Map) GetStringSlice(key string) []string
- func (p *Map) GetUint16(key string) uint16
- func (p *Map) GetUint32(key string) uint32
- func (p *Map) GetUint32Slice(key string) []uint32
- func (p *Map) GetUint64(key string) uint64
- func (p *Map) GetUint64Slice(key string) []uint64
- func (p *Map) Range(f func(key, value interface{})) bool
- func (p *Map) Set(key string, value interface{})
- func (p *Map) ToMap() map[string]interface{}
- func (p *Map) ToSyncMap() *sync.Map
- type MediaType
- type TrieNode
- type TrieTree
- type ValueType
Constants ¶
View Source
const ( MimeJpeg = "image/jpeg" MimeJpg = "image/jpg" MimeGif = "image/gif" MimePng = "image/png" MimeHtml = "text/html" MimePdf = "application/pdf" MimeMpeg = "audio/mpeg" MimeQuicktime = "video/quicktime" MimeMp4 = "video/mp4" MimeWebp = "image/webp" MimeYml = "application/x-yaml" MimeXlsx = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" MimeMsExec = "application/x-ms-dos-executable" MimeText = "text/plain" )
Variables ¶
View Source
var ( LowerLetterRunes = []rune("abcdefghijklmnopqrstuvwxyz") UpperLetterRunes = []rune("ABCDEFGHIJKLMNOPQRSTUVWXYZ") NumberRunes = []rune("0123456789") LetterRunes []rune LetterAndNumberRules []rune )
View Source
var (
ErrNotFound = errors.New("not found")
)
Functions ¶
func AESECBDecrypt ¶
func AESECBEncrypt ¶
func AesCBCDecrypt ¶
func AesCBCEncrypt ¶
func CachePanic ¶
func CachePanic()
func CachePanicWithHandle ¶
func CachePanicWithHandle(handle func(err interface{}))
func CamelToSnake ¶
func DialTimeout ¶
func DiffSlice ¶
func DiffSlice(a interface{}, b interface{}) (interface{}, interface{})
DiffSlice 传入两个slice 如果 a 或者 b 不为 slice 会 panic 如果 a 与 b 的元素类型不一致,也会 panic 返回的第一个参数为 a 比 b 多的,类型为 a 的类型 返回的第二个参数为 b 比 a 多的,类型为 b 的类型
func FileAppend ¶
func FileExists ¶
func FormatDuration ¶
func FormatTime ¶
func GenGpg ¶
func GenGpg() (*pgp.PGPKeyPair, error)
func GetConfigDir ¶
func GetConfigDir() string
func GetErrCode ¶
func GetExecPath ¶
func GetExecPath() string
func GetExitSign ¶
func GetFileModTime ¶
func GetUserConfigDir ¶
func GetUserConfigDir() string
func GetUserHomeDir ¶
func GetUserHomeDir() string
func HmacSha224 ¶
func HmacSha256 ¶
func HmacSha384 ¶
func HmacSha512 ¶
func MapKeysString ¶
func MapKeysString(m interface{}) []string
func MergeCIDRs ¶
func PluckInt32 ¶
func PluckInt64 ¶
func PluckString ¶
func PluckStringSlice ¶
func PluckUint32 ¶
func PluckUint64 ¶
func PrintStack ¶
func PrintStack()
func ProcessBarAscii ¶
func RandStringLetter ¶
func RandStringWithSeed ¶
func RealIpFromFiberCtx ¶
func RealIpFromFiberCtx(ctx *fiber.Ctx) string
func RemoveSlice ¶
func RemoveSlice(src interface{}, rm interface{}) interface{}
RemoveSlice 传入两个slice 如果 src 或者 rm 不为 slice 会 panic 如果 src 与 rm 的元素类型不一致,也会 panic 返回的第一个参数为 src 中不在 rm 中的元素,数据类型与 src 一致
func ShortStr4Web ¶
func Slice2Map ¶
func Slice2Map[M constraints.Ordered](list []M) map[M]bool
func SnakeToCamel ¶
func ToFloat64Slice ¶
func ToFloat64Slice(val interface{}) []float64
func ToInt64Slice ¶
func ToInt64Slice(val interface{}) []int64
Types ¶
type ContentType ¶
type ContentType struct {
// contains filtered or unexported fields
}
func GetContentType ¶
func GetContentType(out io.Reader) (*ContentType, error)
func NewContentType ¶
func NewContentType(raw string) *ContentType
func (*ContentType) MediaType ¶
func (p *ContentType) MediaType() MediaType
func (*ContentType) String ¶
func (p *ContentType) String() string
type Error ¶
type Error struct { ErrCode int32 `json:"err_code,omitempty"` Message string `json:"message,omitempty"` NeedRetry bool `json:"need_retry,omitempty"` }
func NewErrorWithCode ¶
func (*Error) CheckNeedRetry ¶
func (*Error) SetErrCode ¶
func (*Error) SetNeedRetry ¶
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
func NewMapWithAny ¶
func NewMapWithJson ¶
func NewMapWithYaml ¶
func (*Map) DisableCut ¶
func (*Map) GetFloat64 ¶
func (*Map) GetInt64Slice ¶
func (*Map) GetStringSlice ¶
func (*Map) GetUint32Slice ¶
func (*Map) GetUint64Slice ¶
type TrieNode ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.