util

package
v0.0.0-...-0f17f66 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2021 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorNotFound = errors.New("not found")
	ErrorNil      = errors.New("is nil")
)
View Source
var GinDefaultLog io.Writer
View Source
var Json = jsoniter.ConfigCompatibleWithStandardLibrary
View Source
var ToolDesc = map[string]string{
	"TinyProto": "无损压缩png图片",
}
View Source
var Tools = map[string]func(str ...string) bool{
	"TinyProto": TinyProto,
}
View Source
var UserTool map[string]string

Functions

func ConvertPng

func ConvertPng(old, new string) bool

func CreateToken

func CreateToken() (string, error)

生成awt的token

func GetAccessToken

func GetAccessToken() (string, error)

获取微信accessToken

func GetExternalIP

func GetExternalIP() (net.IP, error)

获取首个外网ip v4

func GetInterIp

func GetInterIp() (string, error)

func GetListenAddr

func GetListenAddr(a string) (string, error)

func GetServAddr

func GetServAddr(a net.Addr) (string, error)

func InTool

func InTool(str string) string

func Int64ToStr

func Int64ToStr(num int64) string

func MD5Sum

func MD5Sum(filePath string) ([]byte, error)

func MakeSig

func MakeSig(timestamp, nonce string) string

校验签名

func NewMaterial

func NewMaterial(wxCtx *wechatCtx.Context, path string)

func ParseToken

func ParseToken(tokenStr string) (jwt.MapClaims, error)

解析token

func ParseXmlStr1

func ParseXmlStr1(str string) []string

解析一维字符串

func ParseXmlStr2

func ParseXmlStr2(str string) [][]string

解析二维字符串

func PathExists

func PathExists(path string) (bool, error)

判断路径是否存在,返回true为存在

func TinyProto

func TinyProto(strs ...string) bool

func UseTool

func UseTool(userName string) string

Types

type Status

type Status struct {
	Code    int32
	Message string
}

func FromError

func FromError(err error) (s *Status, ok bool)

func New

func New(c int32, msg string) *Status

func (*Status) GetStatus

func (m *Status) GetStatus() *Status

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL