intl

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ErrorMsgSizeDivisible2 = "size of data must be divisible by 2"
View Source
const ErrorMsgSizeDivisible4 = "size of data must be divisible by 4"
View Source
const ErrorMsgSizeDivisible8 = "size of data must be divisible by 8"
View Source
const ErrorMsgWrongSizeZero = "size cannot be zero"
View Source
const SizeDefault uint32 = 20
View Source
const SizeInt16 = 2
View Source
const SizeInt32 = 4
View Source
const SizeInt64 = 8
View Source
const SizeUint16 = SizeInt16
View Source
const SizeUint32 = SizeInt32
View Source
const SizeUint64 = SizeInt64

Variables

This section is empty.

Functions

This section is empty.

Types

type Base16Encoding

type Base16Encoding struct{}

func (Base16Encoding) DecodeString

func (b Base16Encoding) DecodeString(s string) ([]byte, error)

func (Base16Encoding) EncodeToString

func (b Base16Encoding) EncodeToString(src []byte) string

type BaseXEncoding

type BaseXEncoding struct {
	// contains filtered or unexported fields
}

func (BaseXEncoding) DecodeString

func (b BaseXEncoding) DecodeString(s string) ([]byte, error)

func (BaseXEncoding) EncodeToString

func (b BaseXEncoding) EncodeToString(src []byte) string

type CryptRandReader

type CryptRandReader struct{}

func (CryptRandReader) Read

func (r CryptRandReader) Read(b []byte) (n int, err error)

type EncError

type EncError struct {
	// contains filtered or unexported fields
}

type Encoder

type Encoder interface {
	EncodeToString(src []byte) string
	DecodeString(s string) ([]byte, error)
}

func NewEncoder

func NewEncoder() Encoder

func NewEncoderBase16Std

func NewEncoderBase16Std() Encoder

func NewEncoderBase32Hex

func NewEncoderBase32Hex() Encoder

func NewEncoderBase32Std

func NewEncoderBase32Std() Encoder

func NewEncoderBase36

func NewEncoderBase36() Encoder

func NewEncoderBase62

func NewEncoderBase62() Encoder

func NewEncoderBase64Std

func NewEncoderBase64Std() Encoder

func NewEncoderBase64Url

func NewEncoderBase64Url() Encoder

func NewEncoderBaseX

func NewEncoderBaseX(base int) Encoder

func NewEncoderCustom

func NewEncoderCustom(encoder Encoder) Encoder

type Encoding

type Encoding struct {
	Encoder
}

type ID

type ID struct {
	// contains filtered or unexported fields
}

func (ID) Byte

func (id ID) Byte() []byte

func (ID) Int16

func (id ID) Int16() ([]int16, error)

func (ID) Int32

func (id ID) Int32() ([]int32, error)

func (ID) Int64

func (id ID) Int64() ([]int64, error)

func (ID) String

func (id ID) String() string

func (ID) Uint16

func (id ID) Uint16() ([]uint16, error)

func (ID) Uint32

func (id ID) Uint32() ([]uint32, error)

func (ID) Uint64

func (id ID) Uint64() ([]uint64, error)

type Identifier

type Identifier interface {
	String() string
	Byte() []byte
	Int16() ([]int16, error)
	Uint16() ([]uint16, error)
	Int32() ([]int32, error)
	Uint32() ([]uint32, error)
	Int64() ([]int64, error)
	Uint64() ([]uint64, error)
}

func NewID

func NewID(data []byte, enc Encoder) Identifier

func NewIDStdBase32

func NewIDStdBase32(data []byte) Identifier

type InternalError

type InternalError struct {
	// contains filtered or unexported fields
}

type MockEncoding

type MockEncoding struct {
	EncodedString string
	DecodedBytes  []byte
	DecodedErr    error
}

func (MockEncoding) DecodeString

func (e MockEncoding) DecodeString(s string) ([]byte, error)

func (MockEncoding) EncodeToString

func (e MockEncoding) EncodeToString(src []byte) string

type MockRandReader

type MockRandReader struct {
	Actual    []byte
	ActualErr error
}

func (MockRandReader) Read

func (r MockRandReader) Read(b []byte) (n int, err error)

type Provider

type Provider interface {
	Generate() (Identifier, error)
	Parse(id string) (Identifier, error)
	Byte(id []byte) Identifier
	Int16(id []int16) Identifier
	Uint16(id []uint16) Identifier
	Int32(id []int32) Identifier
	Uint32(id []uint32) Identifier
	Int64(id []int64) Identifier
	Uint64(id []uint64) Identifier
}

func NewProvider

func NewProvider() Provider

func NewProviderCustom

func NewProviderCustom(size uint32, rand Randomizer, enc Encoder) Provider

func NewProviderSize

func NewProviderSize(size uint32) Provider

type Providing

type Providing struct {
	// contains filtered or unexported fields
}

func (Providing) Byte

func (p Providing) Byte(id []byte) Identifier

func (Providing) Generate

func (p Providing) Generate() (Identifier, error)

func (Providing) Int16

func (p Providing) Int16(id []int16) Identifier

func (Providing) Int32

func (p Providing) Int32(id []int32) Identifier

func (Providing) Int64

func (p Providing) Int64(id []int64) Identifier

func (Providing) Parse

func (p Providing) Parse(id string) (Identifier, error)

func (Providing) Uint16

func (p Providing) Uint16(id []uint16) Identifier

func (Providing) Uint32

func (p Providing) Uint32(id []uint32) Identifier

func (Providing) Uint64

func (p Providing) Uint64(id []uint64) Identifier

type Rand

type Rand struct {
	// contains filtered or unexported fields
}

func (Rand) Generate

func (r Rand) Generate(size uint32) ([]byte, error)

type RandError

type RandError struct {
	// contains filtered or unexported fields
}

type Randomizer

type Randomizer interface {
	Generate(size uint32) ([]byte, error)
}

func NewRand

func NewRand() Randomizer

func NewRandCustom

func NewRandCustom(r io.Reader) Randomizer

type WrongSizeError

type WrongSizeError struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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