utils

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: MIT Imports: 2 Imported by: 0

README

公共方法库

Ver 0.0.3

crypt 加密、解密操作
【方法】
方法名 功能 参数 返回值
Md5Hex str(string) 加密字符串 string 加密后字符串
AesEncryptWithKey orig(string)
key(string)
string 加密后字符串
AesDecryptWithKey cryted(string)
key(string)
string 解密后原文
PKCS7Padding PKCS7补码 ciphertext([]byte)
blocksize(int)
[]byte 补码结果
PKCS7UnPadding PKCS7 去码 origData([]byte) []byte 去码结果

file 文件操作
【方法】
方法名 功能 参数 返回值
GetFileTypeWithByte 根据文件字节流判断文件类型 fSrc([]byte)文件字节流 FileType文件类型
GetFileType 根据文件句柄判断文件类型 file(*multipart.File)文件句柄 FileType文件类型
ParseFilePath 解析文件路径 path(string)文件路径 pth(string)路径
fName(string)文件名
ext(string)文件扩展名

【结构体】
FileType
字段名 说明 类型 JSON Key
Type 文件的类型(jpg、png、mp3等) string type
Category 文件的分类(image、media等) string category

net 网络操作
【方法】
方法名 功能 参数 返回值
NewHttpClient
Get
GetSync
Post
PostSync
Put
PutSync
Delete
DeleteSync
SetHeader
GetLocalIP
MacInt64
Mac
Macs
Hex2Dec

【结构体】
HttpClient
字段名 说明 类型 JSON Key
Host 请求Host string
Context 上下文 string
Uri Uri string
Url Url string
Method POST、DELETE、PUT、GET string
Headers 请求头信息 map[string]string
Data 请求Body数据 string
Timeout 超时时间设置 time.Duration
Then 请求后返回事件 chan interface{}
Catch 请求后发生异常事件 chan error

RequestMethod(方便设置,起到ENUM作用)
字段名 说明 类型 JSON Key
GET Get方法 string
POST Post方法 string
PUT Put方法 string
DELETE Delete方法 string

RequestHeader(方便设置,起到ENUM作用)
字段名 说明 类型 JSON Key
XRequestedWith string
XRequestedWithXML string
ContentType string
ContentTypeJSON string

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepCopyStruct

func DeepCopyStruct(dst, src interface{}) error

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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