utils

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: Unlicense Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Base58BytesPool = []byte("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")
View Source
var Conf _ConfNamespace
View Source
var ErrBadHIDValue = errors.New("sha.utils: bad HID token value")

Functions

func B

func B(s string) (b []byte)

func DecodeURI added in v0.0.5

func DecodeURI(src []byte) []byte

func DecodeURIFormed added in v0.0.5

func DecodeURIFormed(src []byte) []byte

func EncodeHeaderValue added in v0.0.5

func EncodeHeaderValue(v []byte, buf *[]byte)

func EncodeHeaderValueToBuf added in v0.0.5

func EncodeHeaderValueToBuf(v []byte, buf io.ByteWriter)

func EncodeURI added in v0.0.5

func EncodeURI(v []byte, buf *[]byte)

func EncodeURIComponent added in v0.0.5

func EncodeURIComponent(v []byte, buf *[]byte)

func EncodeURIComponentToBuf added in v0.0.5

func EncodeURIComponentToBuf(v []byte, buf io.ByteWriter)

func GetUnexportedField added in v0.0.5

func GetUnexportedField(field reflect.Value) interface{}

func InPlaceTrimAsciiSpace added in v0.0.5

func InPlaceTrimAsciiSpace(v []byte) []byte

func MathRandSeed

func MathRandSeed()

func NewDigContainer

func NewDigContainer(opts ...dig.Option) *_Dig

func RandByte

func RandByte(pool []byte) byte

func RandBytes

func RandBytes(dist, pool []byte)

func RecoverIf

func RecoverIf(fn func(interface{}) bool)

func SetUnexportedField added in v0.0.5

func SetUnexportedField(field reflect.Value, value interface{})

Types

type Buf

type Buf struct {
	Data []byte
}

func (*Buf) Reset added in v0.0.5

func (b *Buf) Reset()

func (*Buf) Write

func (b *Buf) Write(p []byte) (int, error)

func (*Buf) WriteByte added in v0.0.5

func (b *Buf) WriteByte(v byte) error

func (*Buf) WriteString added in v0.0.5

func (b *Buf) WriteString(v string)

type BufferPool

type BufferPool struct {
	sync.Pool
	// contains filtered or unexported fields
}

func NewBufferPoll

func NewBufferPoll(maxSize int) *BufferPool

func (*BufferPool) Get

func (pool *BufferPool) Get() *Buf

func (*BufferPool) Put

func (pool *BufferPool) Put(buf *Buf)

type FixedSizeBufferPool

type FixedSizeBufferPool struct {
	BufferPool
	// contains filtered or unexported fields
}

func NewFixedSizeBufferPoll

func NewFixedSizeBufferPoll(defaultSize, maxSize int) *FixedSizeBufferPool

func (*FixedSizeBufferPool) Put

func (pool *FixedSizeBufferPool) Put(buf *Buf)

type HashPool

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

func NewHashPoll

func NewHashPoll(constructor func() hash.Hash, secret []byte) *HashPool

func (*HashPool) Equal

func (hp *HashPool) Equal(v []byte, h []byte) bool

func (*HashPool) Sum

func (hp *HashPool) Sum(v []byte) []byte

type IDTokenGenerator

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

func NewIDTokenGenerator

func NewIDTokenGenerator(pool *HashPool) IDTokenGenerator

func (IDTokenGenerator) DecodeID

func (g IDTokenGenerator) DecodeID(v string) (int64, int64, error)

func (IDTokenGenerator) EncodeID

func (g IDTokenGenerator) EncodeID(v int64) string

type KvItem

type KvItem struct {
	Key []byte
	Val []byte
	// contains filtered or unexported fields
}

type Kvs

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

func (*Kvs) Append

func (kvs *Kvs) Append(k string, v []byte) *KvItem

func (*Kvs) AppendBytes

func (kvs *Kvs) AppendBytes(k, v []byte) *KvItem

func (*Kvs) AppendString added in v0.0.5

func (kvs *Kvs) AppendString(k, v string) *KvItem

func (*Kvs) Cap added in v0.0.5

func (kvs *Kvs) Cap() int

func (*Kvs) Del

func (kvs *Kvs) Del(k string)

func (*Kvs) EachItem

func (kvs *Kvs) EachItem(visitor func(item *KvItem) bool)

func (*Kvs) EachKey

func (kvs *Kvs) EachKey(visitor func(k []byte) bool)

func (*Kvs) EachValue

func (kvs *Kvs) EachValue(visitor func(v []byte) bool)

func (*Kvs) Get

func (kvs *Kvs) Get(k string) ([]byte, bool)

func (*Kvs) GetAll

func (kvs *Kvs) GetAll(k string) [][]byte

func (*Kvs) LoadAny added in v0.0.5

func (kvs *Kvs) LoadAny(v interface{}) bool

func (*Kvs) LoadKvs added in v0.0.5

func (kvs *Kvs) LoadKvs(o *Kvs)

func (*Kvs) LoadMap added in v0.0.5

func (kvs *Kvs) LoadMap(m MultiValueMap)

func (*Kvs) Reset

func (kvs *Kvs) Reset()

func (*Kvs) Set

func (kvs *Kvs) Set(k string, v []byte) *KvItem

func (*Kvs) SetString added in v0.0.5

func (kvs *Kvs) SetString(k, v string) *KvItem

func (*Kvs) Size

func (kvs *Kvs) Size() int

func (*Kvs) String

func (kvs *Kvs) String() string

type M

type M map[string]string

type MultiValueMap added in v0.0.5

type MultiValueMap map[string][]string

type NamedFmt

type NamedFmt struct {
	Args []string
	// contains filtered or unexported fields
}

func NewNamedFmt

func NewNamedFmt(fs string) *NamedFmt

func (*NamedFmt) Render

func (f *NamedFmt) Render(v M) string

type TomlDuration

type TomlDuration struct {
	time.Duration
}

func (*TomlDuration) UnmarshalJSON

func (d *TomlDuration) UnmarshalJSON(text []byte) error

func (*TomlDuration) UnmarshalText

func (d *TomlDuration) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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