Documentation ¶
Index ¶
- Variables
- func BcryptCheck(password, hash string) bool
- func BcryptHash(password string) string
- func BuildPubKey(pubKey string) (*rsa.PublicKey, error)
- func Contains[T comparable](slice []T, element T) bool
- func Convert2Float32(str string, dv float32) float32
- func ConvertPrt2Ids(str *string) []int64
- func ConvertString2Ids(str string) []int64
- func DecodeJwt(jwt string) (*modelo.CustomClaims, error)
- func DecodePayload(payload string) (*modelo.CustomClaims, error)
- func Format[T *time.Time | time.Time](t T, format ...string) string
- func Format1(t *time.Time) stringdeprecated
- func FormatV0(t *time.Time) stringdeprecated
- func FormatVal(t time.Time) stringdeprecated
- func GenRsaCertPair()
- func GenerateCode() string
- func GenerateOrderSN(memberId int64) string
- func GenerateRefundSN(orderID, orderItemID int64) string
- func GenerateUid(length ...int64) string
- func JonIds(ids []int64, sp string) string
- func MD5V(str []byte, b ...byte) string
- func Marshal(val any) (map[string]map[string]any, error)
- func MustParse(tStr string) time.Time
- func NumToLetter(num rune) rune
- func Parse(tStr string) (time.Time, error)
- func ReadAsNestedMap[T Numeric](filePath string, separator rune, fn func(v string, dv T) T, dv T) (map[string]map[string]T, error)
- func ReadPriKey(keyPath string) (*rsa.PrivateKey, error)deprecated
- func ReadPriKeyOfAbPath(abPath string) (*rsa.PrivateKey, error)
- func ReadPubKey(keyPath string) (*rsa.PublicKey, error)deprecated
- func ReadPubKeyOfAbPath(abPath string) (*rsa.PublicKey, error)
- func RemoveBearer(token string) string
- func Shuffle[T any](s []T)
- func ToPrt[T any](i T) *T
- func ToVl[T any](i *T) T
- func TryParse(tStr string) time.Time
- type JWTParser
- type Numeric
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Contains ¶
func Contains[T comparable](slice []T, element T) bool
func Convert2Float32 ¶
func ConvertPrt2Ids ¶
func ConvertString2Ids ¶
func DecodePayload ¶
func DecodePayload(payload string) (*modelo.CustomClaims, error)
func GenRsaCertPair ¶
func GenRsaCertPair()
func GenerateCode ¶ added in v0.2.9
func GenerateCode() string
func GenerateOrderSN ¶
func GenerateRefundSN ¶
func GenerateUid ¶
GenerateUid generates a UUIDv7 and retries up to 10 times in case of error.
func Marshal ¶
Marshal marshals the given val and returns the map that contains the fields. optional=another is not implemented, and it's hard to implement and not common used.
func NumToLetter ¶ added in v0.2.9
func ReadAsNestedMap ¶
func ReadAsNestedMap[T Numeric](filePath string, separator rune, fn func(v string, dv T) T, dv T) (map[string]map[string]T, error)
ReadAsNestedMap 读取CSV文件并返回嵌套的Map
func ReadPriKey
deprecated
func ReadPriKey(keyPath string) (*rsa.PrivateKey, error)
Deprecated: ReadPriKeyOfAbPath 相对路径
func ReadPriKeyOfAbPath ¶
func ReadPriKeyOfAbPath(abPath string) (*rsa.PrivateKey, error)
ReadPriKeyOfAbPath 绝对路径
func ReadPubKey
deprecated
func ReadPubKeyOfAbPath ¶
ReadPubKeyOfAbPath 读取公钥(绝对路径)
func RemoveBearer ¶
RemoveBearer remove token Bearer prefix if necessary
Types ¶
type JWTParser ¶
func GetParserFromKey ¶
func GetParserOfAbPath ¶
func (*JWTParser) ParseToken ¶
func (j *JWTParser) ParseToken(tokenString string) (*modelo.CustomClaims, error)
ParseToken 解析 token
Source Files ¶
Click to show internal directories.
Click to hide internal directories.