Documentation
¶
Index ¶
- Variables
- func AppendInt(buf []byte, u uint64) []byte
- func Base64(data []byte) []byte
- func Base64Raw(data []byte) []byte
- func Base64RawToString(data []byte) string
- func Base64ToString(data []byte) string
- func DecodeInt(buf []byte) uint64
- func EncodeInt(u uint64) []byte
- func ExchangeInt(buf []byte) []byte
- func FillInt(buf []byte, length int) []byte
- func HashInt(data []byte, key []byte) []byte
- func Hex(data []byte) []byte
- func HexToString(data []byte) string
- func HtmlEscape(data []byte) string
- func HtmlUnescape(data string) string
- func SortJoin(v any, separator, connector string, urlEncode bool) string
- func UnBase64(data []byte) ([]byte, error)
- func UnBase64FromString(data string) ([]byte, error)
- func UnHex(data []byte) ([]byte, error)
- func UnHexFromString(data string) ([]byte, error)
- func UnUrlBase64(data []byte) ([]byte, error)
- func UnUrlBase64FromString(data string) ([]byte, error)
- func UnUrlEncode(data string) ([]byte, error)
- func UrlBase64(data []byte) []byte
- func UrlBase64Raw(data []byte) []byte
- func UrlBase64RawToString(data []byte) string
- func UrlBase64ToString(data []byte) string
- func UrlEncode(data []byte) string
- func Utf8Valid(data []byte) bool
- type IntEncoder
- func (enc *IntEncoder) AppendInt(buf []byte, u uint64) []byte
- func (enc *IntEncoder) DecodeInt(buf []byte) uint64
- func (enc *IntEncoder) EncodeInt(u uint64) []byte
- func (enc *IntEncoder) ExchangeInt(buf []byte) []byte
- func (enc *IntEncoder) FillInt(buf []byte, length int) []byte
- func (enc *IntEncoder) HashInt(data []byte, key []byte) []byte
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultIntEncoder, _ = NewIntEncoder("9ukH1grX75TQS6LzpFAjIivsdZoO0mc8NBwnyYDhtMWEC2V3KaGxfJRPqe4lbU", 62)
默认编码器实例
View Source
var OrderedIntEncoder, _ = NewIntEncoder("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 62)
Functions ¶
func Base64RawToString ¶ added in v1.1.0
Base64RawToString 将数据转换为无填充的 Base64 编码的字符串
func ExchangeInt ¶
func HtmlUnescape ¶ added in v1.0.6
HtmlUnescape 对 HTML 字符串进行反转义
func UnBase64FromString ¶ added in v1.0.6
UnBase64FromString 将 Base64 编码的字符串解码(自动兼容有无填充)
func UnHexFromString ¶ added in v1.0.6
UnHexFromString 将 Hex 编码的字符串解码
func UnUrlBase64 ¶
UnUrlBase64 将 URL 安全的 Base64 编码的字节切片解码(自动兼容有无填充)
func UnUrlBase64FromString ¶ added in v1.0.6
UnUrlBase64FromString 将 URL 安全的 Base64 编码的字符串解码(自动兼容有无填充)
func UnUrlEncode ¶ added in v1.0.6
UnUrlEncode 对字符串进行 URL 解码
func UrlBase64Raw ¶ added in v1.1.0
UrlBase64Raw 将数据转换为 URL 安全且无填充的 Base64 编码的字节切片
func UrlBase64RawToString ¶ added in v1.1.0
UrlBase64RawToString 将数据转换为 URL 安全且无填充的 Base64 编码的字符串
func UrlBase64ToString ¶
UrlBase64ToString 将数据转换为 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) DecodeInt ¶
func (enc *IntEncoder) DecodeInt(buf []byte) uint64
DecodeInt 从字节切片解码为整数
func (*IntEncoder) EncodeInt ¶
func (enc *IntEncoder) EncodeInt(u uint64) []byte
EncodeInt 将整数转换为字节切片
func (*IntEncoder) ExchangeInt ¶
func (enc *IntEncoder) ExchangeInt(buf []byte) []byte
ExchangeInt 对字节切片进行位置交替重排
Click to show internal directories.
Click to hide internal directories.