Documentation ¶
Index ¶
- Constants
- Variables
- func AesKeySecureRandom(keyword []byte) (key []byte)
- func ApiResult(status bool, msg string, i interface{}) *map[string]interface{}
- func BinaryStringToBytes(s string) (bs []byte)
- func ByteToBinaryString(b byte) string
- func ByteToFloat32(bytes []byte) float32
- func ByteToFloat64(bytes []byte) float64
- func BytesToBinaryString(bs []byte) string
- func BytesToInt(b []byte) int
- func BytesToInt64(b []byte) (int64, error)
- func Contains(obj interface{}, target interface{}) (bool, error)
- func ConvertFloat(c interface{}) float64
- func CreateUUID(step bool) string
- func EncodeMD5(s string) string
- func EncodeMD5Std(s string) string
- func Error(msg string, err error) error
- func Exist(filename string) bool
- func ExitApp(out chan os.Signal, callback func(os.Signal))
- func FixByesIntLen(b []byte) []byte
- func Float32ToByte(float float32) []byte
- func Float64ToByte(float float64) []byte
- func Floor(num float64, precision int) float64
- func FmtColor(str string, colors ...int) string
- func FormatTime(format_str string, unix_timestamp int64) string
- func GBK2UTF8(s []byte) ([]byte, error)
- func GenerateStruct(key string, data M, indent string)
- func GetBucket(bucketName string, endpoint string, accessID string, accessKey string) (*oss.Bucket, error)
- func GetDirectoryCount(dir_path string) (int, error)
- func GetLocationAddress()
- func HttpGet(url_str string) (string, error)
- func HttpGetBytes(urlStr string) ([]byte, error)
- func HttpPostJsonBytes(url_str string, post_data []byte) ([]byte, error)
- func HttpPostJsonString(url_str string, post_data M) (string, error)
- func Hump2Under(str string) string
- func Inet_aton(ipnr string) int64
- func Inet_ntoa(ipnr int64) string
- func IntToBytes(n int, bit int) []byte
- func LcFirst(str string) string
- func Map2Struct(obj interface{}, stu interface{}) error
- func MapDump(m M) ([]string, []interface{})
- func MapKeys(m map[string]interface{}) []string
- func NewECBDecrypter(b cipher.Block) cipher.BlockMode
- func NewECBEncrypter(b cipher.Block) cipher.BlockMode
- func PKCS7Padding(ciphertext []byte, blockSize int) []byte
- func PKCS7UnPadding(plantText []byte) []byte
- func PathExists(path string) bool
- func PrintAny(any interface{})
- func PrintMap(obj map[string]interface{}, step string)
- func RandRange(min, max int) int
- func RandRange64(min, max int64) int64
- func RandStr(number int, r_table interface{}) string
- func ReadDir(path string) (files []string, dirs []string, err error)
- func ReadDirRecursion(dir_path string) ([]string, error)
- func Round(d float64, position int) float64
- func SHA1(data []byte) []byte
- func SHAPRNGDecode(deText []byte, kenCode []byte) ([]byte, error)
- func SHAPRNGDecodeString(decryptStr string, kenCode string) (string, error)
- func SHAPRNGEncode(plantText []byte, kenCode []byte) ([]byte, error)
- func SHAPRNGEncodeString(encryptStr string, kenCode string) (string, error)
- func SetTimeout(step time.Duration, callback func())
- func StrPad(str string, pad_str string, number int, t int) string
- func StringIndexOf(arr []string, search string) int
- func Struct2Map(obj interface{}, fields []string) map[string]interface{}
- func UTF82GBK(s []byte) ([]byte, error)
- func UcFirst(str string) string
- func Under2Hump(str string) string
- func WritePid(pidName string)
- func YN(condition bool, yes interface{}, no interface{}) interface{}
- type AesEncrypt
- func (a *AesEncrypt) Decrypt(deStr []byte) ([]byte, error)
- func (a *AesEncrypt) DecryptString(deStr string) (string, error)
- func (a *AesEncrypt) DecryptUrl(plantText []byte) ([]byte, error)
- func (a *AesEncrypt) Encrypt(plantText []byte) ([]byte, error)
- func (a *AesEncrypt) EncryptString(plantText string) (string, error)
- func (a *AesEncrypt) EncryptUrl(plantText []byte) ([]byte, error)
- func (a *AesEncrypt) GetKey() []byte
- func (a *AesEncrypt) SetBase64(chk bool)
- func (a *AesEncrypt) SetIV(iv []byte)
- func (a *AesEncrypt) SetKey(k string)
- func (a *AesEncrypt) SetKeyBytes(k []byte)
- func (a *AesEncrypt) SetPkcs(flag bool)
- func (a *AesEncrypt) SetType(t string)
- type DesCipher
- func (d *DesCipher) Decrypt(data []byte) ([]byte, error)
- func (d *DesCipher) DecryptString(data string) (string, error)
- func (d *DesCipher) Encrypt(data []byte) ([]byte, error)
- func (d *DesCipher) EncryptString(data string) (string, error)
- func (d *DesCipher) SetIV(iv []byte)
- func (d *DesCipher) SetKey(key []byte)
- type ExecTime
- type HD
- type HttpClient
- func (h *HttpClient) Clear()
- func (h *HttpClient) Get(url_str string) ([]byte, error)
- func (h *HttpClient) GetLastResponse() *HttpRequestData
- func (h *HttpClient) Post(url_str string, data M) ([]byte, error)
- func (h *HttpClient) PostJson(url_str string, data M) ([]byte, error)
- func (h *HttpClient) PostJsonBytes(urlStr string, data []byte) ([]byte, error)
- func (h *HttpClient) PostJsonString(urlStr string, data string) ([]byte, error)
- func (h *HttpClient) PostXml(url_str string, data string) ([]byte, error)
- func (h *HttpClient) Request(method string, url_str string, content io.Reader) (*HttpRequestData, error)
- func (h *HttpClient) SetCookie(cookie *http.Cookie)
- func (h *HttpClient) SetHeader(key, val string)
- func (h *HttpClient) SetTimeout(sc time.Duration)
- func (h *HttpClient) SetTransport(transport *http.Transport)
- func (h *HttpClient) Upload(urlStr string, fileName string, fs io.Reader, fields M) ([]byte, error)
- type HttpCookies
- type HttpRequestData
- type JsonParse
- type M
- type ResData
- type XMLMap
Constants ¶
const ( AES_CBC = "cbc" AES_ECB = "ecb" )
const ( //前景色 FBLACK = 30 FRED = 31 FGREEN = 32 FYELLOW = 33 FBLUE = 34 FFUCHSIA = 35 FCYAN = 36 FWHITE = 37 //背景色 BBLACK = 40 BRED = 41 BGREEN = 42 BYELLOW = 43 BBLUE = 44 BFUCHSIA = 45 BCYAN = 46 BWHITE = 47 //显示模式 SDEF = 0 //终端默认 SHGH = 1 //高亮显示 SUNL = 4 //下划线 SLL = 5 //闪烁 SB = 7 //反白显示 SNO = 8 //不可见 )
const ( STR_PAD_LEFT = 1 + iota STR_PAD_RIGHT )
Variables ¶
var ErrBadStringFormat = errors.New("bad string format")
ErrBadStringFormat represents a error of input string's format is illegal .
var ErrEmptyString = errors.New("empty string")
ErrEmptyString represents a error of empty input string.
Functions ¶
func AesKeySecureRandom ¶ added in v1.1.6
func BinaryStringToBytes ¶
BinaryStringToBytes get the binary bytes according to the input string which is in binary format.
func ByteToBinaryString ¶
ByteToBinaryString get the string in binary format of a byte or uint8.
func ByteToFloat32 ¶
func ByteToFloat64 ¶
func BytesToBinaryString ¶
BytesToBinaryString get the string in binary format of a []byte or []int8.
func EncodeMD5Std ¶
func Float32ToByte ¶
func Float64ToByte ¶
func FormatTime ¶
func GenerateStruct ¶ added in v1.5.9
JSON 生成 struct 结构内容
func GetBucket ¶
func GetBucket(bucketName string, endpoint string, accessID string, accessKey string) (*oss.Bucket, error)
Get bucket
func GetDirectoryCount ¶
func GetLocationAddress ¶
func GetLocationAddress()
func HttpPostJsonBytes ¶
http post JSON 数据,返回一个 []byte 数组
func HttpPostJsonString ¶
http post JSON 数据,返回一个 string 数据
func Inet_aton ¶
Convert net.IP to int64 , http://www.outofmemory.cn
func PKCS7Padding ¶ added in v1.2.3
PKCS7 处理
func PathExists ¶
func ReadDirRecursion ¶
func SHAPRNGDecode ¶ added in v1.1.6
func SHAPRNGDecodeString ¶ added in v1.1.6
func SHAPRNGEncode ¶ added in v1.1.6
func SHAPRNGEncodeString ¶ added in v1.1.6
func StringIndexOf ¶
Types ¶
type AesEncrypt ¶
type AesEncrypt struct {
// contains filtered or unexported fields
}
func (*AesEncrypt) DecryptString ¶
func (a *AesEncrypt) DecryptString(deStr string) (string, error)
解密字符串
func (*AesEncrypt) DecryptUrl ¶ added in v1.2.6
func (a *AesEncrypt) DecryptUrl(plantText []byte) ([]byte, error)
解密BASE64URL的密码
func (*AesEncrypt) EncryptString ¶
func (a *AesEncrypt) EncryptString(plantText string) (string, error)
加密返回字符串
func (*AesEncrypt) EncryptUrl ¶ added in v1.2.6
func (a *AesEncrypt) EncryptUrl(plantText []byte) ([]byte, error)
加密返回BASE64 URL
func (*AesEncrypt) SetBase64 ¶ added in v1.4.1
func (a *AesEncrypt) SetBase64(chk bool)
设置是否自动base64返回
func (*AesEncrypt) SetKeyBytes ¶ added in v1.3.5
func (a *AesEncrypt) SetKeyBytes(k []byte)
type DesCipher ¶ added in v1.2.3
type DesCipher struct { DesType string // contains filtered or unexported fields }
func NewDesCipher ¶ added in v1.2.3
func (*DesCipher) DecryptString ¶ added in v1.2.3
func (*DesCipher) EncryptString ¶ added in v1.2.3
type ExecTime ¶
type ExecTime struct {
// contains filtered or unexported fields
}
func NewExecTime ¶
func NewExecTime() *ExecTime
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
http 请求客户端
func (*HttpClient) GetLastResponse ¶
func (h *HttpClient) GetLastResponse() *HttpRequestData
得到最后一次请求的返回数据
func (*HttpClient) Post ¶
func (h *HttpClient) Post(url_str string, data M) ([]byte, error)
发起一个POST请求
func (*HttpClient) PostJson ¶
func (h *HttpClient) PostJson(url_str string, data M) ([]byte, error)
发起一个POST JSON请求 接收utils.M
func (*HttpClient) PostJsonBytes ¶ added in v1.6.1
func (h *HttpClient) PostJsonBytes(urlStr string, data []byte) ([]byte, error)
发起一个POST JSON请求 接收JSON 字节数组
func (*HttpClient) PostJsonString ¶
func (h *HttpClient) PostJsonString(urlStr string, data string) ([]byte, error)
发起一个POST JSON请求 接收JSON字符串
func (*HttpClient) PostXml ¶
func (h *HttpClient) PostXml(url_str string, data string) ([]byte, error)
发起一个POST XML请求
func (*HttpClient) Request ¶
func (h *HttpClient) Request(method string, url_str string, content io.Reader) (*HttpRequestData, error)
发起一个http request 请求
func (*HttpClient) SetTransport ¶ added in v1.2.1
func (h *HttpClient) SetTransport(transport *http.Transport)
设置使用HTTP代理,tls证书访问等
type HttpCookies ¶
cookie集合处理
func NewHttpCookies ¶
func NewHttpCookies(cookies ...*http.Cookie) *HttpCookies
func (*HttpCookies) GetCookieString ¶
func (hc *HttpCookies) GetCookieString() string
type HttpRequestData ¶
type HttpRequestData struct { Status string StatusCode int Headers http.Header Content []byte Cookie *HttpCookies }
http 请求返回数据
type JsonParse ¶
type JsonParse struct {
ParseObject interface{}
}
func NewJsonParse ¶ added in v1.0.8
func NewJsonParse(obj interface{}) *JsonParse
func (*JsonParse) ParseJsonString ¶
func (*JsonParse) ToJsonString ¶
type M ¶
type M map[string]interface{}
func HttpPostJson ¶
http post JSON 数据,返回一个MAP数据
func (*M) ParseJsonString ¶
func (*M) ToJsonString ¶
type ResData ¶
type ResData struct { Status bool `json:"status"` Msg string `json:"msg"` Data interface{} `json:"data"` }
func (*ResData) ParseJsonString ¶
func (*ResData) ToJsonString ¶
type XMLMap ¶
type XMLMap map[string]interface{}
func (XMLMap) MarshalXML ¶
MarshalXML marshals the map to XML, with each key in the map being a tag and it's corresponding value being it's contents.
func (*XMLMap) UnmarshalXML ¶
UnmarshalXML unmarshals the XML into a map of string to strings, creating a key in the map for each tag and setting it's value to the tags contents.
The fact this function is on the pointer of Map is important, so that if m is nil it can be initialized, which is often the case if m is nested in another xml structurel. This is also why the first thing done on the first line is initialize it.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
/腾讯云短信发送
|
/腾讯云短信发送 |
Package uuid provides implementation of Universally Unique Identifier (UUID).
|
Package uuid provides implementation of Universally Unique Identifier (UUID). |