Documentation
¶
Index ¶
- func CouldBeValidHash(str string) bool
- func IsBase64String(str string) bool
- func IsBinaryString(str string) bool
- func IsBits8String(str string) bool
- func IsHexString(str string) bool
- type Base64
- type Binary
- type Bits8
- type Ciphered
- type Hash
- type Hashes
- type Key
- type Keys
- type Model
- type Signature
- type UUID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CouldBeValidHash ¶
CouldBeValidHash returns `true` if the passed string could be a 32-bytes or 64-bytes hash in hexadecimal representation
func IsHexString ¶ added in v1.0.3
IsHexString checks whether the passed string is an hexadecimal number of even length.
Types ¶
type Base64 ¶
type Base64 string
Base64 is the base64 string representation of a byte array. NB: if the passed string is not a valid base64 representation, it will not throw an error but rather returns empty or nil items when methods are called.
type Binary ¶
type Binary string
Binary is the string representation of a binary literal, eg. Binary("1001") would equal to `0b1001` in other languages or starting with version 1.13 of Golang. NB: if the underlying string is not a valid string representation of a binary, it will not throw an error but rather return an empty or nil item for each method called.
type Bits8 ¶
type Bits8 uint8
Bits8 is an 8-bit representation of a bit set, ie. a single byte/octet
type Ciphered ¶
type Ciphered string
Ciphered is the base64 string representation of a ciphered text.
type Hash ¶
type Hash string
Hash is the hexadecimal string representation of a hash.Hash It's either a 32-character, or a 64-character long and more.
type Model ¶
type Model interface { // Bytes returns the underlying byte array of the data Bytes() []byte // String returns the usual string representation of the data String() string // IsEmpty checks whether there is no data, ie. it's an empty byte array IsEmpty() bool // NonEmpty tells if the underlying data is not void NonEmpty() bool }
Model defines the basic interface for each core model type.
All types should also define their own `To<TypeName>` function to get an object of the type from a byte array, eg. `func ToHash(bytes []byte) Hash` for the `Hash` type.
Invalid data for the `Model` type should not throw errors but rather act as if they were empty.
type Signature ¶
type Signature string
Signature is the hexadecimal string representation of a signature.