Documentation
¶
Index ¶
- Variables
- func AppendInt(buf []byte, u uint64) []byte
- func Base64(data any) string
- func Base64Raw(data any) string
- func DecodeInt(data any) uint64
- func EncodeInt(u uint64) []byte
- func ExchangeInt(data any) []byte
- func FillInt(data any, length int) []byte
- func HTMLEscape(data any) string
- func HTMLUnescape(data any) string
- func HashInt(buf []byte) []byte
- func Hex(data any) string
- func SortJoin(v any, separator, connector string, urlEncode bool) string
- func URLBase64(data any) string
- func URLBase64Raw(data any) string
- func URLEncode(data any) string
- func UTF8Valid(data any) bool
- func UnBase64(data any) ([]byte, error)
- func UnHex(data any) ([]byte, error)
- func UnURLBase64(data any) ([]byte, error)
- func UnURLEncode(data any) ([]byte, error)
- type IntEncoder
- func (enc *IntEncoder) AppendInt(buf []byte, u uint64) []byte
- func (enc *IntEncoder) DecodeInt(data any) uint64
- func (enc *IntEncoder) EncodeInt(u uint64) []byte
- func (enc *IntEncoder) ExchangeInt(data any) []byte
- func (enc *IntEncoder) FillInt(data any, length int) []byte
- func (enc *IntEncoder) FoldInt(buf []byte, length int) []byte
- func (enc *IntEncoder) HashInt(buf []byte) []byte
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultIntEncoder, _ = NewIntEncoder("9ukH1grX75TQS6LzpFAjIivsdZoO0mc8NBwnyYDhtMWEC2V3KaGxfJRPqe4lbU", 62)
默认编码器实例
View Source
var OrderedIntEncoder, _ = NewIntEncoder("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 62)
Functions ¶
func URLBase64Raw ¶
URLBase64Raw 将数据转换为 URL 安全且无填充的 Base64 编码的字符串
func UnURLBase64 ¶
UnURLBase64 将 URL 安全的 Base64 编码的数据解码为字节切片(自动兼容有无填充)
Types ¶
type IntEncoder ¶
type IntEncoder struct {
// contains filtered or unexported fields
}
IntEncoder 提供整数与字节切片之间的自定义进制转换
func NewIntEncoder ¶
func NewIntEncoder(digits string, radix uint8) (*IntEncoder, error)
NewIntEncoder 创建一个新的整数编码器
func (*IntEncoder) AppendInt ¶
func (enc *IntEncoder) AppendInt(buf []byte, u uint64) []byte
AppendInt 将整数追加到已有字节切片中
func (*IntEncoder) EncodeInt ¶
func (enc *IntEncoder) EncodeInt(u uint64) []byte
EncodeInt 将整数转换为字节切片
func (*IntEncoder) ExchangeInt ¶
func (enc *IntEncoder) ExchangeInt(data any) []byte
ExchangeInt 对数据进行位置交替重排,就地修改并返回
func (*IntEncoder) FillInt ¶
func (enc *IntEncoder) FillInt(data any, length int) []byte
FillInt 使用随机字符序列填充数据至指定长度,高并发下具备零锁极速随机性能,就地修改并返回
func (*IntEncoder) FoldInt ¶
func (enc *IntEncoder) FoldInt(buf []byte, length int) []byte
FoldInt 使用编码器的字符集模加法,将超出 length 的尾部字节折叠到前 length 字节中,就地修改并截断返回
func (*IntEncoder) HashInt ¶
func (enc *IntEncoder) HashInt(buf []byte) []byte
HashInt 双向非线性渐进式置换混淆,原地修改并返回,所有值保持在 radix 字符集内
Click to show internal directories.
Click to hide internal directories.