Documentation
¶
Index ¶
- Constants
- func Abs(path string) (string, error)
- func AesDecrypt(encrypted, key, iv []byte) (string, error)
- func AesEncrypt(plaintext, key, iv []byte) (string, error)
- func CallPath(s int) string
- func CamelToSnake(input string) string
- func ChMod(name string, mode os.FileMode)
- func CopyFile(src, dest string) (w int64, err error)
- func Exec(acts ...string) (string, error)
- func FileExists(name string) bool
- func FromBase64(src string) ([]byte, error)
- func GetPrivateFromStr(key string) (*rsa.PrivateKey, error)
- func GetPrivateStr(key *rsa.PrivateKey) (string, error)
- func GetPublicFromStr(key string) (*rsa.PublicKey, error)
- func GetPublicStr(key *rsa.PublicKey) (string, error)
- func GetRsaKey(bits int) (public *rsa.PublicKey, private *rsa.PrivateKey, err error)
- func GetRunnerPath() string
- func HashMd5(s string) string
- func HashSha256(msg string) string
- func HashSha256Byte(msg []byte) []byte
- func Home() (string, error)
- func InList(str string, list []string) bool
- func InsertAt[T any](slice []T, index int, value T) []T
- func IsWindows() bool
- func MkFile(dest string) (*os.File, error)
- func MultiErr(errs ...error) error
- func PKCS7Padding(ciphertext []byte, blockSize int) []byte
- func PKCS7UnPadding(origData []byte) ([]byte, bool)
- func PathExists(path string) (bool, error)
- func PathIsDir(p string) bool
- func PathJoin(paths ...string) string
- func Rand(n int) []byte
- func RandSeq(n int) string
- func RemoveRep(slc []string) []string
- func RsaCheckSign(msg string, sign string, key *rsa.PublicKey) error
- func RsaDecode(msg string, key *rsa.PrivateKey) (string, error)
- func RsaEncode(msg string, key *rsa.PublicKey) (string, error)
- func RsaSign(msg string, key *rsa.PrivateKey) (string, error)
- func SliceGet[T any](slice []T, fc func(T) bool) *T
- func SnakeToCamel(input string) string
- func SnakeToPrivateCamel(input string) string
- func SortItems(x any, less func(i int, j int, sid func(string) int) bool, items ...string)
- func ToBase64(src []byte) string
- func ToLowerFirst(s string) string
- func ToTitle(str string) string
- type FastLocker
- type SafeBool
Constants ¶
View Source
const (
Version = "v0.4.2"
)
Variables ¶
This section is empty.
Functions ¶
func AesDecrypt ¶
AesDecrypt 使用 AES-256-CBC 进行解密
func AesEncrypt ¶
AesEncrypt 使用 AES-256-CBC 进行加密 key 256 bit / 32 Byte iv 128 bit / 16 Byte
func CamelToSnake ¶ added in v0.4.2
CamelToSnake 将驼峰命名法转换为下划线命名法 例如:CamelToSnake("CamelToSnake") => "camel_to_snake" special case: CaseID => case_id
func FileExists ¶ added in v0.2.2
FileExists reports whether the named file or directory exists.
func FromBase64 ¶ added in v0.2.2
func GetPrivateFromStr ¶ added in v0.2.2
func GetPrivateFromStr(key string) (*rsa.PrivateKey, error)
func GetPrivateStr ¶ added in v0.2.2
func GetPrivateStr(key *rsa.PrivateKey) (string, error)
func GetRunnerPath ¶ added in v0.2.2
func GetRunnerPath() string
Get the absolute path to the running directory
func HashSha256 ¶ added in v0.2.2
func HashSha256Byte ¶ added in v0.2.2
func IsWindows ¶ added in v0.2.2
func IsWindows() bool
Determine whether the current system is a Windows system?
func PKCS7Padding ¶ added in v0.4.2
PKCS7Padding 添加 PKCS#7 填充
func PKCS7UnPadding ¶ added in v0.4.2
PKCS7UnPadding 移除 PKCS#7 填充
func RsaCheckSign ¶ added in v0.2.2
func SnakeToCamel ¶ added in v0.4.2
func SnakeToPrivateCamel ¶ added in v0.4.2
Types ¶
type FastLocker ¶
type FastLocker struct {
// contains filtered or unexported fields
}
func (*FastLocker) Lock ¶
func (mu *FastLocker) Lock()
func (*FastLocker) Unlock ¶
func (mu *FastLocker) Unlock()
type SafeBool ¶
type SafeBool uint32
线程安全的标志位 set 方法保证置换操作的原子性
func (*SafeBool) ForceSetFalse ¶
func (b *SafeBool) ForceSetFalse()
func (*SafeBool) ForceSetTrue ¶
func (b *SafeBool) ForceSetTrue()
Source Files
¶
Click to show internal directories.
Click to hide internal directories.