fn

package module
v0.0.0-...-79bc186 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 24 Imported by: 1

Documentation

Index

Constants

View Source
const (
	KB
	MB
	GB
	TB
)

Variables

This section is empty.

Functions

func AesDecryptCBC

func AesDecryptCBC(encrypted []byte, key, iv []byte) ([]byte, error)

func AesDecryptCFB

func AesDecryptCFB(encrypted []byte, key, iv []byte) ([]byte, error)

func AesDecryptECB

func AesDecryptECB(encrypted []byte, key []byte) ([]byte, error)

func AesEncryptCBC

func AesEncryptCBC(plainText []byte, key, iv []byte) ([]byte, error)

func AesEncryptCFB

func AesEncryptCFB(origData []byte, key, iv []byte) ([]byte, error)

=================== CFB ======================

func AesEncryptECB

func AesEncryptECB(origData []byte, key []byte) ([]byte, error)

=================== ECB ======================

func Exist

func Exist(p string) bool

Exist 判断路径是否存在

func Head(f string, n int) string

读取文件前 n行

func InSlice

func InSlice[T comparable](target []T) func(T) bool

InSlice 判断是否在切片里

func IsBlank

func IsBlank(v any) bool

IsBlank 判断值是否为空

func LastCut

func LastCut(src, sep string) (before, after string, found bool)

LastCut

func Ls

func Ls(p string)

func Md5sum

func Md5sum(b []byte) string

Md5 计算值

func PrintJson

func PrintJson(value interface{}) (e error)

TestPrintJson 以json格式打印测试结果

func Set

func Set[T comparable](s []T) (r []T)

Set 切片去重复

func Sha1Sum

func Sha1Sum(b []byte) string

func Sha256sum

func Sha256sum(b []byte) string

Sha256 计算值

func SliceTurning

func SliceTurning[T comparable](target []T, limit int) chan []T

func Sum

func Sum(b []byte, hash hash.Hash) []byte

func Tail

func Tail(f string, n int) string

Tail 输出文件 第n个

func ToBytes

func ToBytes(s string) []byte

func ToString

func ToString(b []byte) string

func WriteJson

func WriteJson(value interface{}, file string) error

WriteJson 以json格式写入某个文件路径

func ZipFile

func ZipFile(source, target string, level int) error

ZipFile 压缩某个路径的文件或者文件夹,生成一个target的zip文件

Types

type Map

type Map[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func (*Map[K, V]) Delete

func (r *Map[K, V]) Delete(key K) V

func (*Map[K, V]) Load

func (r *Map[K, V]) Load(key K) (V, bool)

func (*Map[K, V]) Range

func (r *Map[K, V]) Range(fn func(key K, value V))

func (*Map[K, V]) Store

func (r *Map[K, V]) Store(key K, value V)

type Result

type Result[T any] struct {
	// contains filtered or unexported fields
}

func Err

func Err[T any](e error) Result[T]

func Ok

func Ok[T any](t T) Result[T]

func Try

func Try[T any](some T, e error) Result[T]

func (*Result[T]) Err

func (r *Result[T]) Err() error

func (*Result[T]) IsErr

func (r *Result[T]) IsErr() bool

func (*Result[T]) Match

func (r *Result[T]) Match(onSuccess func(value T) (T, error), onError func(err error) (T, error)) Result[T]

func (*Result[T]) Some

func (r *Result[T]) Some() T

func (*Result[T]) Unwrap

func (r *Result[T]) Unwrap() T

Jump to

Keyboard shortcuts

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