encoding

package
v0.0.0-...-f214a0b Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// newStr := NewBase32Encoding(encoder string).WithPadding(NoPadding).EncodeToString(src []byte)
	// newStr, err := NewBase32Encoding(encoder string).WithPadding(NoPadding).DecodeString(src string)
	NewBase32Encoding = base32.NewEncoding
)
View Source
var (
	// newStr := NewBase64Encoding(encoder string).WithPadding(NoPadding).EncodeToString(src []byte)
	// newStr, err := NewBase64Encoding(encoder string).WithPadding(NoPadding).DecodeString(src string)
	NewBase64Encoding = base64.NewEncoding
)
View Source
var UseEncoding = NewDataSet[string, IEncoding]()

EncodeDecode

Functions

func BaseConvert

func BaseConvert(number string, frombase, tobase int) string

各种进制互转 十进制转十六进制 Base Convert BaseConvert("12312", 10, 16) [2- 36] 进制

func Bindec

func Bindec(str string) int64

二进制转十进制 bin to dec

func Decbin

func Decbin(number int64) string

十进制转二进制 dec to bin

func Dechex

func Dechex(number int64) string

十进制转十六进制 dec to hex

func Decoct

func Decoct(number int64) string

十进制转八进制 dec to oct

func Hexdec

func Hexdec(str string) int64

十六进制转十进制 hex to dec

func Octdec

func Octdec(str string) int64

八进制转十进制 oct to dec

Types

type DataName

type DataName interface {
	~uint | ~int | ~string
}

type DataSet

type DataSet[N DataName, M any] struct {
	// contains filtered or unexported fields
}

*

  • Data Set *
  • @create 2023-3-31
  • @author deatil

func NewDataSet

func NewDataSet[N DataName, M any]() *DataSet[N, M]

NewDataSet

func (*DataSet[N, M]) Add

func (this *DataSet[N, M]) Add(name N, data func() M) *DataSet[N, M]

Add

func (*DataSet[N, M]) All

func (this *DataSet[N, M]) All() map[N]func() M

All

func (*DataSet[N, M]) Clean

func (this *DataSet[N, M]) Clean()

Clean

func (*DataSet[N, M]) Get

func (this *DataSet[N, M]) Get(name N) func() M

Get

func (*DataSet[N, M]) Has

func (this *DataSet[N, M]) Has(name N) bool

Has

func (*DataSet[N, M]) Len

func (this *DataSet[N, M]) Len() int

Len

func (*DataSet[N, M]) Names

func (this *DataSet[N, M]) Names() []N

Names

func (*DataSet[N, M]) Remove

func (this *DataSet[N, M]) Remove(name N) *DataSet[N, M]

Remove

type Encoding

type Encoding struct {

	// Error
	Error error
	// contains filtered or unexported fields
}

*

  • Encode *
  • @create 2022-4-3
  • @author deatil

func FromBytes

func FromBytes(data []byte) Encoding

FromBytes

func FromReader

func FromReader(reader io.Reader) Encoding

FromReader

func FromString

func FromString(data string) Encoding

FromString

func New

func New() Encoding

New

func NewEncoding

func NewEncoding() Encoding

NewEncoding

func (Encoding) Asn1Decode

func (this Encoding) Asn1Decode(val any) Encoding

Asn1 Decode

func (Encoding) Asn1DecodeWithParams

func (this Encoding) Asn1DecodeWithParams(val any, params string) Encoding

Asn1 Decode

func (Encoding) Asn1Encode

func (this Encoding) Asn1Encode(data any) Encoding

Asn1 Encode

func (Encoding) Asn1EncodeWithParams

func (this Encoding) Asn1EncodeWithParams(data any, params string) Encoding

Asn1 Encode

func (Encoding) Base100Decode

func (this Encoding) Base100Decode() Encoding

Base100 Decode

func (Encoding) Base100Encode

func (this Encoding) Base100Encode() Encoding

Base100 Encode

func (Encoding) Base32Decode

func (this Encoding) Base32Decode() Encoding

Decode Base32

func (Encoding) Base32DecodeWithEncoder

func (this Encoding) Base32DecodeWithEncoder(encoder string) Encoding

Decode Base32Encoder

func (Encoding) Base32Encode

func (this Encoding) Base32Encode() Encoding

Encode Base32

func (Encoding) Base32EncodeWithEncoder

func (this Encoding) Base32EncodeWithEncoder(encoder string) Encoding

Encode Base32Encoder

func (Encoding) Base32HexDecode

func (this Encoding) Base32HexDecode() Encoding

Decode Base32 Hex

func (Encoding) Base32HexEncode

func (this Encoding) Base32HexEncode() Encoding

Encode Base32 Hex

func (Encoding) Base32RawDecode

func (this Encoding) Base32RawDecode() Encoding

Decode Base32 raw

func (Encoding) Base32RawDecodeWithEncoder

func (this Encoding) Base32RawDecodeWithEncoder(encoder string) Encoding

Decode Base32Encoder raw

func (Encoding) Base32RawEncode

func (this Encoding) Base32RawEncode() Encoding

Encode Base32 raw

func (Encoding) Base32RawEncodeWithEncoder

func (this Encoding) Base32RawEncodeWithEncoder(encoder string) Encoding

Encode Base32Encoder raw

func (Encoding) Base32RawHexDecode

func (this Encoding) Base32RawHexDecode() Encoding

Decode Base32Hex raw

func (Encoding) Base32RawHexEncode

func (this Encoding) Base32RawHexEncode() Encoding

Encode Base32Hex raw

func (Encoding) Base36Decode

func (this Encoding) Base36Decode() Encoding

Decode Base36

func (Encoding) Base36Encode

func (this Encoding) Base36Encode() Encoding

Encode Base36

func (Encoding) Base45Decode

func (this Encoding) Base45Decode() Encoding

Base45 Decode

func (Encoding) Base45Encode

func (this Encoding) Base45Encode() Encoding

Base45 Encode

func (Encoding) Base58Decode

func (this Encoding) Base58Decode() Encoding

Base58 Decode

func (Encoding) Base58Encode

func (this Encoding) Base58Encode() Encoding

Base58 Encode

func (Encoding) Base62Decode

func (this Encoding) Base62Decode() Encoding

Base62 Decode

func (Encoding) Base62Encode

func (this Encoding) Base62Encode() Encoding

Base62 Encode

func (Encoding) Base64Decode

func (this Encoding) Base64Decode() Encoding

Base64 Decode

func (Encoding) Base64DecodeWithEncoder

func (this Encoding) Base64DecodeWithEncoder(encoder string) Encoding

Base64 Decode With Encoder

func (Encoding) Base64Encode

func (this Encoding) Base64Encode() Encoding

Base64 Encode

func (Encoding) Base64EncodeWithEncoder

func (this Encoding) Base64EncodeWithEncoder(encoder string) Encoding

Base64 Encode With Encoder

func (Encoding) Base64RawDecode

func (this Encoding) Base64RawDecode() Encoding

Base64 Raw Decode

func (Encoding) Base64RawEncode

func (this Encoding) Base64RawEncode() Encoding

Base64 Raw Encode

func (Encoding) Base64RawURLDecode

func (this Encoding) Base64RawURLDecode() Encoding

Base64RawURL Decode

func (Encoding) Base64RawURLEncode

func (this Encoding) Base64RawURLEncode() Encoding

Base64RawURL Encode

func (Encoding) Base64SegmentDecode

func (this Encoding) Base64SegmentDecode(paddingAllowed ...bool) Encoding

Base64Segment Decode

func (Encoding) Base64SegmentEncode

func (this Encoding) Base64SegmentEncode() Encoding

Base64Segment Encode

func (Encoding) Base64URLDecode

func (this Encoding) Base64URLDecode() Encoding

Base64 URL Decode

func (Encoding) Base64URLEncode

func (this Encoding) Base64URLEncode() Encoding

Base64 URL Encode

func (Encoding) Base85Decode

func (this Encoding) Base85Decode() Encoding

Base85 Decode

func (Encoding) Base85Encode

func (this Encoding) Base85Encode() Encoding

Base85 Encode

func (Encoding) Base91Decode

func (this Encoding) Base91Decode() Encoding

Base91 Decode

func (Encoding) Base91Encode

func (this Encoding) Base91Encode() Encoding

Base91 Encode

func (Encoding) Base92Decode

func (this Encoding) Base92Decode() Encoding

Base92 Decode

func (Encoding) Base92Encode

func (this Encoding) Base92Encode() Encoding

Base92 Encode

func (Encoding) Basex16Decode

func (this Encoding) Basex16Decode() Encoding

Basex16 Decode

func (Encoding) Basex16Encode

func (this Encoding) Basex16Encode() Encoding

Base16 Encode

func (Encoding) Basex2Decode

func (this Encoding) Basex2Decode() Encoding

Basex2 Decode

func (Encoding) Basex2Encode

func (this Encoding) Basex2Encode() Encoding

Base2 Encode

func (Encoding) Basex62Decode

func (this Encoding) Basex62Decode() Encoding

Basex62 Decode

func (Encoding) Basex62Encode

func (this Encoding) Basex62Encode() Encoding

Basex62 Encode

func (Encoding) BasexDecodeWithEncoder

func (this Encoding) BasexDecodeWithEncoder(encoder string) Encoding

Basex Decode With Encoder

func (Encoding) BasexEncodeWithEncoder

func (this Encoding) BasexEncodeWithEncoder(encoder string) Encoding

Basex Encode With Encoder

func (Encoding) BinaryBigEndianDecode

func (this Encoding) BinaryBigEndianDecode(dst any) Encoding

Binary Big Endian Decode

func (Encoding) BinaryBigEndianEncode

func (this Encoding) BinaryBigEndianEncode(data any) Encoding

Binary Big Endian Encode

func (Encoding) BinaryLittleEndianDecode

func (this Encoding) BinaryLittleEndianDecode(dst any) Encoding

Binary Little Endian Decode

func (Encoding) BinaryLittleEndianEncode

func (this Encoding) BinaryLittleEndianEncode(data any) Encoding

Binary Little Endian Encode

func (Encoding) ConvertBinDecode

func (this Encoding) ConvertBinDecode(data string) Encoding

二进制 ConvertBinDecode

func (Encoding) ConvertBinEncode

func (this Encoding) ConvertBinEncode() string

输出 二进制 ConvertBinEncode

func (Encoding) ConvertDecDecode

func (this Encoding) ConvertDecDecode(data int64) Encoding

十进制 ConvertDecDecode

func (Encoding) ConvertDecEncode

func (this Encoding) ConvertDecEncode() int64

输出 十进制 ConvertDecEncode

func (Encoding) ConvertDecStringDecode

func (this Encoding) ConvertDecStringDecode(data string) Encoding

十进制字符 ConvertDecStringDecode

func (Encoding) ConvertDecStringEncode

func (this Encoding) ConvertDecStringEncode() string

输出 十进制 ConvertDecStringEncode

func (Encoding) ConvertDecode

func (this Encoding) ConvertDecode(input any, base int, bitSize ...int) Encoding

ConvertDecode 给定类型数据格式化为string类型数据 bitSize 限制长度 ParseBool()、ParseFloat()、ParseInt()、ParseUint()。 FormatBool()、FormatInt()、FormatUint()、FormatFloat()、

func (Encoding) ConvertEncode

func (this Encoding) ConvertEncode(base int) string

输出进制Encode ConvertEncode

func (Encoding) ConvertHexDecode

func (this Encoding) ConvertHexDecode(data string) Encoding

十六进制 ConvertHexDecode

func (Encoding) ConvertHexEncode

func (this Encoding) ConvertHexEncode() string

输出 十六进制 ConvertHexEncode

func (Encoding) ConvertOctDecode

func (this Encoding) ConvertOctDecode(data string) Encoding

八进制 ConvertOctDecode

func (Encoding) ConvertOctEncode

func (this Encoding) ConvertOctEncode() string

输出 八进制 ConvertOctEncode

func (Encoding) CsvDecode

func (this Encoding) CsvDecode(dst any, opts ...rune) Encoding

Csv Decode

func (Encoding) CsvEncode

func (this Encoding) CsvEncode(data [][]string) Encoding

Csv Encode

func (Encoding) DecodeBy

func (this Encoding) DecodeBy(name string, cfg ...map[string]any) Encoding

Decode

func (Encoding) EncodeBy

func (this Encoding) EncodeBy(name string, cfg ...map[string]any) Encoding

Encode

func (Encoding) FromBytes

func (this Encoding) FromBytes(data []byte) Encoding

From Bytes

func (Encoding) FromReader

func (this Encoding) FromReader(reader io.Reader) Encoding

FromReader

func (Encoding) FromString

func (this Encoding) FromString(data string) Encoding

FromString

func (Encoding) GobDecode

func (this Encoding) GobDecode(dst any) Encoding

Gob Decode

func (Encoding) GobEncode

func (this Encoding) GobEncode(data any) Encoding

Gob Encode

func (Encoding) HexDecode

func (this Encoding) HexDecode() Encoding

Hex Decode

func (Encoding) HexEncode

func (this Encoding) HexEncode() Encoding

Hex Encode

func (Encoding) JSONDecode

func (this Encoding) JSONDecode(dst any) Encoding

JSON Decode

func (Encoding) JSONEncode

func (this Encoding) JSONEncode(data any) Encoding

JSON Encode

func (Encoding) JSONIteratorDecode

func (this Encoding) JSONIteratorDecode(dst any) Encoding

JSONIterator Decode

func (Encoding) JSONIteratorEncode

func (this Encoding) JSONIteratorEncode(data any) Encoding

JSONIterator Encode

func (Encoding) JSONIteratorIndentEncode

func (this Encoding) JSONIteratorIndentEncode(v any, prefix, indent string) Encoding

JSONIterator Indent Encode

func (Encoding) MorseITUDecode

func (this Encoding) MorseITUDecode() Encoding

MorseITU Decode

func (Encoding) MorseITUEncode

func (this Encoding) MorseITUEncode() Encoding

MorseITU Encode

func (Encoding) PunyDecode

func (this Encoding) PunyDecode() Encoding

PunyDecode Decode

func (Encoding) PunyEncode

func (this Encoding) PunyEncode() Encoding

Puny Encode

func (Encoding) QuotedprintableDecode

func (this Encoding) QuotedprintableDecode() Encoding

quotedprintable Decode

func (Encoding) QuotedprintableEncode

func (this Encoding) QuotedprintableEncode() Encoding

quotedprintable Encode

func (Encoding) SafeURLDecode

func (this Encoding) SafeURLDecode() Encoding

SafeURL Decode

func (Encoding) SafeURLEncode

func (this Encoding) SafeURLEncode() Encoding

SafeURL Encode

func (Encoding) SerializeDecode

func (this Encoding) SerializeDecode(val any) Encoding

Serialize Decode

func (Encoding) SerializeEncode

func (this Encoding) SerializeEncode(data any) Encoding

Serialize Encode

func (Encoding) String

func (this Encoding) String() string

output String

func (Encoding) ToBytes

func (this Encoding) ToBytes() []byte

output Bytes

func (Encoding) ToReader

func (this Encoding) ToReader() io.Reader

output io.Reader

func (Encoding) ToString

func (this Encoding) ToString() string

output String

func (Encoding) XmlDecode

func (this Encoding) XmlDecode(dst any) Encoding

Xml Decode

func (Encoding) XmlEncode

func (this Encoding) XmlEncode(data any) Encoding

Xml Encode

type IEncoding

type IEncoding interface {
	// Encode
	Encode([]byte, ...map[string]any) ([]byte, error)

	// Decode
	Decode([]byte, ...map[string]any) ([]byte, error)
}

EncodeDecode接口

Jump to

Keyboard shortcuts

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