utils

package
v0.0.0-...-f961e09 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDir

func CreateDir(dirs ...string) (err error)

CreateDir 批量创建文件夹

func DeLFile

func DeLFile(filePath string) error

func FileExist

func FileExist(path string) bool

FileExist 判断文件是否存在

func FileMove

func FileMove(src string, dst string) (err error)

FileMove @function: FileMove @description: 文件移动供外部调用 @param: src string, dst string(src: 源位置,绝对路径or相对路径, dst: 目标位置,绝对路径or相对路径,必须为文件夹) @return: err error

func GenValidateCode

func GenValidateCode(width int, codeType uint8) string

GenValidateCode 生成随机数 如:短信验证码等 codeType为1时候,字符串和数字

func Get

func Get(Url string) ([]byte, error)

Get 发送get请求方式

func GrpcWithConsul

func GrpcWithConsul(serverName string) (*grpc.ClientConn, error)

GrpcWithConsul 通过grpc方式来调用consul中心的通过grpc协议的微服务

func IsContain

func IsContain(items []string, item string) bool

IsContain 判断元素是否存在数组list中

func Md5

func Md5(s []byte) string

Md5 md5加密

func Min

func Min(nums ...float64) float64

Min 最小值

func NewConsulClient

func NewConsulClient(address, token string) (apiClient *consulapi.Client, err error)

newConsulClient 连接consul服务

func PathExists

func PathExists(path string) (bool, error)

PathExists 文件目录是否存在

func PostForm

func PostForm(Url string, data map[string]string) ([]byte, error)

PostForm 发送post请求方式

func Reload

func Reload(sss ...func()) error

Reload 重启服务

func TrimSpace

func TrimSpace(target interface{})

TrimSpace 去除结构体空格 target: 目标结构体,传入必须是指针类型

func ZipFiles

func ZipFiles(filename string, files []string, oldForm, newForm string) error

ZipFiles 压缩文件

Types

type URLUtil

type URLUtil struct {
	// contains filtered or unexported fields
}

URLUtil url转换

func ParseURL

func ParseURL(raw string) (*URLUtil, error)

ParseURL 解析url string

func (*URLUtil) Encode

func (u *URLUtil) Encode() string

Encode 编码生成url

func (*URLUtil) Query

func (u *URLUtil) Query() url.Values

Query 获取参数

func (*URLUtil) SetParam

func (u *URLUtil) SetParam(key, value string)

SetParam 设置参数

Jump to

Keyboard shortcuts

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