tools

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool2YN

func Bool2YN(target bool) string

Bool2YN : bool to Y or N string

func CRC32Hash

func CRC32Hash(str string) string

CRC32Hash : string CRC32 hash

func CallerInfo

func CallerInfo(callstack int) (string, int)

CallerInfo : 印出func 被誰call

func CallerInfo2

func CallerInfo2(callstack int) (file string, funcName string, line int)

func CheckInArray

func CheckInArray(str string, array []string) bool

CheckInArray : 搜尋字串

func CheckServIsOn

func CheckServIsOn(host, port string, wait time.Duration) bool

CheckServIsOn : 確認伺服器啟動狀態

func CheckSign

func CheckSign(resData string, targetSign string, md5Key string) bool

CheckSign : 比對簽名檔

func CreateRandomID_24

func CreateRandomID_24(salt string) string

CreateRandomID_24 : 開頭用hash的隨機數(長度共24字)

func CreateRandomID_32

func CreateRandomID_32(salt string) string

CreateRandomID_32 : 開頭用hash的隨機數(長度共32字)

func CreateRandomID_Any

func CreateRandomID_Any(n int) string

CreateRandomID_Any : 取得隨機產生的字串

func CreateRandomID_AnySalt

func CreateRandomID_AnySalt(salt string, n int) string

CreateRandomID_AnySalt : 開頭用hash的隨機數(可指定長度)

func DotNetQueryEscape

func DotNetQueryEscape(str string) string

DotNetQueryEscape : 以 ASP.NET 方式轉換 QueryEscape

func GetEncrypt

func GetEncrypt(signStr string, rsaPublicKey string) string

func GetFunctionName

func GetFunctionName(i interface{}) string

GetFunctionName : 丟入整個func轉出該func的名字

func GetMemeryUseKB

func GetMemeryUseKB() uint64

GetMemeryUseKB : 取得目前記憶體使用量(KB)

func GetMicroUnixTime

func GetMicroUnixTime(_t time.Time) int64

GetMicroUnixTime : 將時間轉為毫秒(ms) unixtime

func GetSign

func GetSign(signStr string, md5Key string) string

GetSign : 產生MD5 簽名檔

func HexToCarry

func HexToCarry(hex string, carry int) string

func IsJSONString

func IsJSONString(str string) bool

IsJSONString : 確認是否為JSON的字串

func IsJSONStringV2

func IsJSONStringV2(str string) bool

IsJSONString : 確認是否為JSON的字串

func IsTemporary

func IsTemporary(err error) bool

IsTemporary : 確認錯誤是否可重試(全自動)

func IsTimeout

func IsTimeout(err error) bool

IsTimeout : 確認錯誤是否為超時

func JSONAutoUnmarshal

func JSONAutoUnmarshal(str string, v interface{}) error

JSONAutoUnmarshal : 自動判斷是 JSON 字串或檔案並轉為 Struct

func JSONFileUnmarshal

func JSONFileUnmarshal(path string, v interface{}) error

JSONFileUnmarshal : 將JSON檔案轉為Struct

func MD5hash

func MD5hash(str string) string

MD5hash : string MD5 hash

func NowMicroUnixTime

func NowMicroUnixTime() int64

NowMicroUnixTime : 現在的MicroUnixTime

func NumOnly

func NumOnly(str string) (int64, error)

NumOnly : 將字串只保留數字

func OnlyQueryEscapeToLower

func OnlyQueryEscapeToLower(str string) string

OnlyQueryEscapeToLower : 只把 QueryEscape 的字轉為小寫

%2E -> %2e

func PaySign

func PaySign(privateKeyString string, mReq map[string]interface{}) string

func PrintSelfName

func PrintSelfName() string

PrintSelfName : 印出func名稱

func PrivateEncryptMD5withRSA

func PrivateEncryptMD5withRSA(data string, privt *rsa.PrivateKey) (string, error)

func RsaSign

func RsaSign(origData string, privateKey *rsa.PrivateKey) (string, error)

func SHA1Hash

func SHA1Hash(s string) string

SHA1Hash : string SHA-1 hash

func SHA256Hash

func SHA256Hash(s string) string

SHA256Hash : string SHA256 hash

func StructPrint

func StructPrint(_struct interface{})

StructPrint : 印出資料結構 (自動換行縮排)

Types

This section is empty.

Jump to

Keyboard shortcuts

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