codec

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func B62Decode added in v0.0.29

func B62Decode(encoded string) []byte

B62Decode 将Base62字符串解码为字节切片

func B62Encode added in v0.0.29

func B62Encode(raw []byte) string

B62Encode 字节切片([]byte)编码为Base62字符串

func B64Decode added in v0.0.23

func B64Decode(s string) ([]byte, error)

B64Decode 将 base64 文本解码为二进制

func B64DecodeJSON added in v0.0.23

func B64DecodeJSON[T any](s string) (T, error)

B64DecodeJSON 将 base64 -> json -> 结构体(泛型版)

func B64DecodeStream added in v0.0.23

func B64DecodeStream(w io.Writer, r io.Reader) (int64, error)

B64DecodeStream 从 r 读 base64 文本,写解码后的二进制到 w

func B64Encode added in v0.0.23

func B64Encode(b []byte) string

B64Encode 将二进制编码为 base64 文本

func B64EncodeJSON added in v0.0.23

func B64EncodeJSON(v any) (string, error)

B64EncodeJSON 将任意结构体 -> json -> base64

func B64EncodeStream added in v0.0.23

func B64EncodeStream(w io.Writer, r io.Reader) (int64, error)

B64EncodeStream 从 r 读原始二进制,写 base64 文本到 w

func B64RawDecode added in v0.0.23

func B64RawDecode(s string) ([]byte, error)

B64RawDecode 将 base64 文本解码为二进制

func B64RawEncode added in v0.0.23

func B64RawEncode(b []byte) string

B64RawEncode 将二进制编码为 base64 文本

func B64URLDecode added in v0.0.23

func B64URLDecode(s string) ([]byte, error)

B64URLDecode 解码 URL 安全 base64

func B64URLDecodeJSON added in v0.0.23

func B64URLDecodeJSON[T any](s string) (T, error)

B64URLDecodeJSON URL 安全版(泛型)

func B64URLDecodeStream added in v0.0.23

func B64URLDecodeStream(w io.Writer, r io.Reader) error

func B64URLEncode added in v0.0.23

func B64URLEncode(b []byte) string

B64URLEncode 无填充、URL 安全的 base64

func B64URLEncodeJSON added in v0.0.23

func B64URLEncodeJSON(v any) (string, error)

B64URLEncodeJSON URL 安全版(无 '=')

func B64URLEncodeStream added in v0.0.23

func B64URLEncodeStream(w io.Writer, r io.Reader) error

B64URLEncodeStream URL 安全流式(可选)

func JSONMarshal

func JSONMarshal(value any) ([]byte, error)

JSONMarshal 将value转为bytes

func JSONUnmarshal

func JSONUnmarshal(bytes []byte, value any) error

JSONUnmarshal 将bytes反序列化为value相对应的结构

func JSONUnmarshalTo

func JSONUnmarshalTo[T any](bytes []byte) (T, error)

JSONUnmarshalTo 将bytes反序列化为泛型相对应的结构

func MPMarshal

func MPMarshal(value any) ([]byte, error)

MPMarshal 将value转为bytes

func MPUnmarshal

func MPUnmarshal(bytes []byte, value any) error

MPUnmarshal 将bytes反序列化为value相对应的结构

func MPUnmarshalTo

func MPUnmarshalTo[T any](bytes []byte) (T, error)

MPUnmarshalTo 将bytes反序列化为泛型相对应的结构

func MustB64EncodeJSON added in v0.0.23

func MustB64EncodeJSON(v any) string

MustB64EncodeJSON 便捷方法(panic on error,谨慎用于初始化场景)

Types

This section is empty.

Jump to

Keyboard shortcuts

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