core

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const IDSize = 16

Variables

View Source
var IDBase64Len = len(ID{}.Base64())
View Source
var IDHexLen = len(ID{}.Hex())
View Source
var IDStringLen = IDBase64Len

Functions

func Decrypt

func Decrypt(d []byte, key Key) ([]byte, error)

func Encrypt

func Encrypt(d []byte, key Key) []byte

Types

type Binary

type Binary []byte

func BinaryFromBoolean

func BinaryFromBoolean(b bool) Binary

func BinaryFromFloat64

func BinaryFromFloat64(f float64) Binary

func BinaryFromInt

func BinaryFromInt(i int64) Binary

func BinaryFromString

func BinaryFromString(s string) Binary

func BinaryFromTime

func BinaryFromTime(date time.Time) Binary

func BinaryFromUint

func BinaryFromUint(i uint64) Binary

func ParseBinary

func ParseBinary(h string) Binary

func ParseBinaryBase64

func ParseBinaryBase64(s string) Binary

func ParseBinaryHex

func ParseBinaryHex(h string) Binary

func (*Binary) Base64

func (d *Binary) Base64() string

func (*Binary) Decrypt

func (d *Binary) Decrypt(key Key) error

func (*Binary) Encrypt

func (d *Binary) Encrypt(key Key)

func (Binary) Equals

func (d Binary) Equals(data Binary) bool

func (*Binary) FromBoolean

func (d *Binary) FromBoolean(b bool) error

func (*Binary) FromFloat64

func (d *Binary) FromFloat64(f float64) error

func (*Binary) FromInt64

func (d *Binary) FromInt64(i int64) error

func (*Binary) FromString

func (d *Binary) FromString(s string) error

func (*Binary) FromTime

func (d *Binary) FromTime(date time.Time) error

func (*Binary) FromUint

func (d *Binary) FromUint(i uint64) error

func (Binary) Hash64

func (d Binary) Hash64() uint64

func (Binary) Hex

func (d Binary) Hex() string

func (Binary) MarshalJSON

func (d Binary) MarshalJSON() ([]byte, error)

func (Binary) MarshalYAML

func (d Binary) MarshalYAML() (interface{}, error)

func (Binary) String

func (d Binary) String() string

func (Binary) ToBoolean

func (d Binary) ToBoolean() (bool, error)

func (Binary) ToFloat64

func (d Binary) ToFloat64() (float64, error)

func (Binary) ToID

func (d Binary) ToID() ID

func (Binary) ToInt64

func (d Binary) ToInt64() (int64, error)

func (Binary) ToRID

func (d Binary) ToRID() RichID

func (Binary) ToString

func (d Binary) ToString() (string, error)

func (Binary) ToTime

func (d Binary) ToTime() (time.Time, error)

func (Binary) ToUint

func (d Binary) ToUint() (uint64, error)

func (*Binary) UnmarshalJSON

func (d *Binary) UnmarshalJSON(b []byte) error

func (*Binary) UnmarshalYAML

func (d *Binary) UnmarshalYAML(value *yaml.Node) error

type BinaryOut

type BinaryOut <-chan Binary

func (BinaryOut) IDs

func (s BinaryOut) IDs() IDsOut

func (BinaryOut) List

func (s BinaryOut) List() []Binary

type BinaryPairOut

type BinaryPairOut <-chan [2]Binary

func (BinaryPairOut) List

func (s BinaryPairOut) List() [][2]Binary

type ID

type ID [IDSize]byte
var MaxID ID
var MinID ID

func B2ID

func B2ID(b Binary) ID

func MustParseID

func MustParseID(str string) ID

func NewID

func NewID() ID

func ParseID

func ParseID(str string) (ID, error)

func ParseIDBase32

func ParseIDBase32(str string) (ID, error)

func ParseIDBase62

func ParseIDBase62(str string) (ID, error)

func ParseIDBase64

func ParseIDBase64(str string) (ID, error)

func ParseIDHex

func ParseIDHex(str string) (ID, error)

func ParseIDNC

func ParseIDNC(i interface{}) ID

func UnwrapID

func UnwrapID(rid RichID) ID

func UnwrapRID

func UnwrapRID(rid RichID) (ID, byte)

func (ID) Base32

func (id ID) Base32() string

func (ID) Base62

func (id ID) Base62() string

func (ID) Base64

func (id ID) Base64() string

func (ID) Equals

func (id ID) Equals(other ID) bool

func (ID) Hex

func (id ID) Hex() string

func (ID) Invert

func (id ID) Invert() ID

func (ID) IsNull

func (id ID) IsNull() bool

func (ID) LessThan

func (id ID) LessThan(other ID) bool

func (ID) MarshalJSON

func (id ID) MarshalJSON() ([]byte, error)

func (ID) MarshalYAML

func (id ID) MarshalYAML() (interface{}, error)

func (ID) String

func (id ID) String() string

func (*ID) UnmarshalJSON

func (id *ID) UnmarshalJSON(b []byte) error

func (*ID) UnmarshalYAML

func (id *ID) UnmarshalYAML(value *yaml.Node) error

type IDBoundGroup

type IDBoundGroup []IDBounds

func (*IDBoundGroup) Add

func (idg *IDBoundGroup) Add(b IDBounds)

func (*IDBoundGroup) AddAll

func (idg *IDBoundGroup) AddAll(bs IDBoundGroup)

func (IDBoundGroup) Contains

func (idg IDBoundGroup) Contains(id ID) bool

func (*IDBoundGroup) Remove

func (idg *IDBoundGroup) Remove(b IDBounds) bool

type IDBounds

type IDBounds struct {
	Lower ID
	Upper ID
}
var MaxBounds IDBounds

func ParseIDBounds

func ParseIDBounds(ibstr string) (IDBounds, error)

func (IDBounds) Contains

func (ib IDBounds) Contains(id ID) bool

func (IDBounds) MarshalJSON

func (ib IDBounds) MarshalJSON() ([]byte, error)

func (IDBounds) MarshalYAML

func (ib IDBounds) MarshalYAML() (interface{}, error)

func (IDBounds) Middle

func (ib IDBounds) Middle() ID

func (IDBounds) NewID

func (ib IDBounds) NewID() ID

func (IDBounds) Split

func (ib IDBounds) Split() [2]IDBounds

func (IDBounds) String

func (ib IDBounds) String() string

func (*IDBounds) UnmarshalJSON

func (ib *IDBounds) UnmarshalJSON(b []byte) error

func (*IDBounds) UnmarshalYAML

func (ib *IDBounds) UnmarshalYAML(value *yaml.Node) error

type IDList

type IDList []ID

func (IDList) Contains

func (ic IDList) Contains(id ID) bool

func (IDList) Copy

func (ic IDList) Copy() IDList

func (IDList) Len

func (ic IDList) Len() int

func (IDList) Less

func (ic IDList) Less(i, j int) bool

func (IDList) MarshalJSON

func (ic IDList) MarshalJSON() ([]byte, error)

func (*IDList) Remove

func (ic *IDList) Remove(id ID, remove int) int

func (IDList) Set

func (ic IDList) Set() IDSet

func (*IDList) Swap

func (ic *IDList) Swap(i, j int)

func (*IDList) UnmarshalJSON

func (ic *IDList) UnmarshalJSON(b []byte) error

type IDMap

type IDMap map[ID]ID

func (IDMap) ContainsValue

func (rs IDMap) ContainsValue(id ID) bool

func (IDMap) KeyByValue

func (rs IDMap) KeyByValue(id ID) *ID

func (IDMap) KeySet

func (rs IDMap) KeySet() IDSet

func (IDMap) MarshalJSON

func (rs IDMap) MarshalJSON() ([]byte, error)

func (IDMap) MarshalYAML

func (rs IDMap) MarshalYAML() (interface{}, error)

func (IDMap) Pick

func (rs IDMap) Pick() ID

func (*IDMap) UnmarshalJSON

func (rs *IDMap) UnmarshalJSON(b []byte) error

func (*IDMap) UnmarshalYAML

func (rs *IDMap) UnmarshalYAML(value *yaml.Node) error

func (IDMap) ValueSet

func (rs IDMap) ValueSet() IDSet

func (IDMap) Values

func (rs IDMap) Values() []ID

type IDPair

type IDPair [2]ID

type IDPairList

type IDPairList []IDPair

func (IDPairList) Keys

func (il IDPairList) Keys() IDList

func (IDPairList) Map

func (il IDPairList) Map() IDMap

func (IDPairList) Values

func (il IDPairList) Values() IDList

type IDPairsIn

type IDPairsIn chan<- IDPair

type IDPairsOut

type IDPairsOut <-chan IDPair

func (IDPairsOut) Keys

func (s IDPairsOut) Keys() IDsOut

func (IDPairsOut) Length

func (s IDPairsOut) Length() int64

func (IDPairsOut) List

func (s IDPairsOut) List() []IDPair

func (IDPairsOut) Map

func (s IDPairsOut) Map() IDMap

func (IDPairsOut) Values

func (s IDPairsOut) Values() IDsOut

type IDSet

type IDSet map[ID]bool

func NewIDSet

func NewIDSet(ids ...ID) IDSet

func (*IDSet) AddAll

func (ic *IDSet) AddAll(set IDSet)

func (IDSet) Contains

func (ic IDSet) Contains(id ID) bool

func (IDSet) Copy

func (ic IDSet) Copy() IDSet

func (IDSet) Hash

func (ic IDSet) Hash() ID

func (*IDSet) List

func (ic *IDSet) List() IDList

func (IDSet) MarshalJSON

func (ic IDSet) MarshalJSON() ([]byte, error)

func (*IDSet) SortedList

func (ic *IDSet) SortedList() IDList

func (*IDSet) UnmarshalJSON

func (ic *IDSet) UnmarshalJSON(b []byte) error

func (IDSet) Without

func (ic IDSet) Without(n IDSet) IDSet

type IDsIn

type IDsIn chan<- ID

type IDsOut

type IDsOut <-chan ID

func (IDsOut) Length

func (s IDsOut) Length() int64

func (IDsOut) List

func (s IDsOut) List() IDList

func (IDsOut) Pipe

func (s IDsOut) Pipe(s2 IDsIn)

func (IDsOut) Set

func (s IDsOut) Set() IDSet

func (IDsOut) Unique

func (s IDsOut) Unique() IDsOut

type Key

type Key [32]byte

type KeyedIDPair

type KeyedIDPair struct {
	Key  Binary `json:"key"`
	Pair IDPair `json:"pair"`
}

type KeyedIDPairList

type KeyedIDPairList []KeyedIDPair

func (KeyedIDPairList) Keys

func (il KeyedIDPairList) Keys() IDList

func (KeyedIDPairList) Map

func (il KeyedIDPairList) Map() IDMap

func (KeyedIDPairList) Values

func (il KeyedIDPairList) Values() IDList

type KeyedIDPairsIn

type KeyedIDPairsIn chan<- KeyedIDPair

type KeyedIDPairsOut

type KeyedIDPairsOut <-chan KeyedIDPair

func (KeyedIDPairsOut) Length

func (s KeyedIDPairsOut) Length() int64

func (KeyedIDPairsOut) List

func (s KeyedIDPairsOut) List() []KeyedIDPair

func (KeyedIDPairsOut) PairKeys

func (s KeyedIDPairsOut) PairKeys() IDsOut

func (KeyedIDPairsOut) PairList

func (s KeyedIDPairsOut) PairList() []IDPair

func (KeyedIDPairsOut) PairMap

func (s KeyedIDPairsOut) PairMap() IDMap

func (KeyedIDPairsOut) PairValueList

func (s KeyedIDPairsOut) PairValueList() IDList

func (KeyedIDPairsOut) PairValueSet

func (s KeyedIDPairsOut) PairValueSet() IDSet

func (KeyedIDPairsOut) PairValues

func (s KeyedIDPairsOut) PairValues() IDsOut

func (KeyedIDPairsOut) Pairs

func (s KeyedIDPairsOut) Pairs() IDPairsOut

type RichID

type RichID [IDSize + 1]byte

func ParseRID

func ParseRID(str string) (RichID, error)

func WrapID

func WrapID(id ID, info byte) RichID

func (RichID) HasFlag

func (id RichID) HasFlag(flag byte) bool

func (RichID) Hex

func (id RichID) Hex() string

func (*RichID) SetFlag

func (id *RichID) SetFlag(flag byte)

func (RichID) String

func (id RichID) String() string

func (*RichID) UnsetFlag

func (id *RichID) UnsetFlag(flag byte)

Jump to

Keyboard shortcuts

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