Documentation
¶
Overview ¶
file: url_match.go Package urlmatch 提供与 Gin 路由语义一致的 URL 匹配工具(对称匹配)
Index ¶
- Constants
- func BcryptCheck(password, hash string) bool
- func BcryptHash(password string) string
- func Cc2Udl(str string) string
- func Eval(str string) (evalVal string)
- func FillToLen(str string, length int) string
- func FillToLenByChar(str string, length int, char string) string
- func FirstLower(s string) string
- func FirstUpper(s string) string
- func GenLicense(privateKeyStr string, payload LicensePayload) ([]byte, error)
- func GenRSAKeyPair(bits int) (privateKeyPEM string, publicKeyPEM string, err error)
- func GetInstance() *idGenerator
- func HexToBigInt(hex string) *big.Int
- func HexToInt64(hex string) int64
- func HidStr(str string, prefixLen int, suffixLen int) string
- func InitSnowFlakeWorker(workerID, dataCenterID int64) error
- func Int64ToStr(num int64) string
- func IntToStr(num int) string
- func InterfaceToBigInt(v interface{}) *big.Int
- func InterfaceToByte(v interface{}) []byte
- func InterfaceToDecimal(v interface{}) decimal.Decimal
- func InterfaceToFloat32(v interface{}) float32
- func InterfaceToFloat64(v interface{}) float64
- func InterfaceToInt(v interface{}) int
- func InterfaceToInt8(v interface{}) int8
- func InterfaceToInt16(v interface{}) int16
- func InterfaceToInt32(v interface{}) int32
- func InterfaceToInt64(v interface{}) int64
- func InterfaceToStr(v interface{}) string
- func InterfaceToUInt(v interface{}) uint
- func InterfaceToUInt8(v interface{}) uint8
- func InterfaceToUInt16(v interface{}) uint16
- func InterfaceToUInt32(v interface{}) uint32
- func InterfaceToUInt64(v interface{}) uint64
- func MD5V(str []byte, b ...byte) string
- func MapToStruct(mapValue interface{}, structValue interface{}) (err error)
- func PrintBlack(content ...interface{})
- func PrintBlue(content ...interface{})
- func PrintGreen(content ...interface{})
- func PrintLnBlack(content ...interface{})
- func PrintLnBlue(content ...interface{})
- func PrintLnGreen(content ...interface{})
- func PrintLnRed(content ...interface{})
- func PrintLnWhite(content ...interface{})
- func PrintLnYellow(content ...interface{})
- func PrintRed(content ...interface{})
- func PrintWhite(content ...interface{})
- func PrintYellow(content ...interface{})
- func RandomHexStr(len int) (str string)
- func RandomNumStr(len int) (randomNum string)
- func ReFormatMoney(str string) string
- func SnowFlakeNextID() (int64, error)
- func StrFilterChinese(src string) string
- func StrFilterNum(src string) string
- func StrIsNumber(str string) bool
- func StrToInt(num string) int
- func StrToInt8(num string) int8
- func StrToInt16(num string) int16
- func StrToInt32(num string) int32
- func StrToInt64(num string) int64
- func StrToUInt(num string) uint
- func StrToUInt8(num string) uint8
- func StrToUInt16(num string) uint16
- func StrToUInt32(num string) uint32
- func StrToUInt64(num string) uint64
- func StructToMap(obj interface{}) (data map[string]interface{})
- func TrimSpace(objJsonStr string) string
- func Udl2LCC(s string) (camelCase string)
- func Udl2UCC(s string) (camelCase string)
- func UnderscoreToCamel(name string) string
- func Unique[T unique](t []T) []T
- func UrlIsEq(source, target string) bool
- type Color
- type ConsoleColorLog
- type LicensePayload
- type SignedLicense
- type Worker
Constants ¶
View Source
const ( Black = "Black" White = "White" Red = "Red" Blue = "Blue" Yellow = "Yellow" Green = "Green" )
View Source
const Print = 0
View Source
const PrintLn = 1
Variables ¶
This section is empty.
Functions ¶
func GenLicense ¶
func GenLicense(privateKeyStr string, payload LicensePayload) ([]byte, error)
func GenRSAKeyPair ¶
GenRSAKeyPair 生成 RSA 公私钥(PEM 格式字符串)。 私钥使用 PKCS8 编码,公钥使用 PKIX 编码,和当前签名/验签逻辑保持一致。
func GetInstance ¶
func GetInstance() *idGenerator
func HidStr ¶
隐藏字符串以*代替 包含fromIndex,但是不包含toIndex 和 slice的规则一致
func MapToStruct ¶
func MapToStruct(mapValue interface{}, structValue interface{}) (err error)
将map转为struct
func ReFormatMoney ¶
ReFormatMoney 格式化金额 格式化规则: 从右边开始按照每3个长度切割字符串并使用 `,` 拼接 e.g: input:12000 -> output:12,000 ; input:1200000 -> output:1,200,000
func SnowFlakeNextID ¶
* 通过雪花算法获取id @return int64 生成的id @return error 返回的错误
func Udl2LCC ¶
Udl2LCC 下划线转小驼峰 underline to lower camel case
func Udl2UCC ¶
Udl2UCC 下划线转大驼峰 underline to upper camel case
func Unique ¶
func Unique[T unique](t []T) []T
Types ¶
type ConsoleColorLog ¶
type ConsoleColorLog struct {
}
func (ConsoleColorLog) Debug ¶
func (c ConsoleColorLog) Debug(args ...interface{})
func (ConsoleColorLog) Error ¶
func (c ConsoleColorLog) Error(args ...interface{})
func (ConsoleColorLog) Info ¶
func (c ConsoleColorLog) Info(args ...interface{})
func (ConsoleColorLog) Panic ¶
func (c ConsoleColorLog) Panic(args ...interface{})
func (ConsoleColorLog) Warn ¶
func (c ConsoleColorLog) Warn(args ...interface{})
type LicensePayload ¶
type LicensePayload struct {
Version string `json:"version"`
LicenseID string `json:"licenseID"`
Customer string `json:"customer"`
Product string `json:"product"`
NotBefore time.Time `json:"notBefore"`
NotAfter time.Time `json:"notAfter"`
Features []string `json:"features"`
}
func VerifyLicense ¶
func VerifyLicense(publicKeyStr string, licenseFile string) (bool, *LicensePayload)
type SignedLicense ¶
type SignedLicense struct {
Payload LicensePayload `json:"payload"`
Signature string `json:"signature"` // base64
}
Source Files
¶
- cert.go
- console_color_print.go
- hash.go
- slice.go
- snowflake.go
- str.go
- url.go
Click to show internal directories.
Click to hide internal directories.