Documentation
¶
Index ¶
- Constants
- type Id
- type IdHash
- func (i *IdHash) Bytes() (b []byte)
- func (i *IdHash) FromId(id []byte) (err error)
- func (i *IdHash) FromIdBase64(idb64 string) (err error)
- func (i *IdHash) FromIdHex(idh string) (err error)
- func (i *IdHash) MarshalWrite(w io.Writer) (err error)
- func (i *IdHash) Set(idh []byte)
- func (i *IdHash) UnmarshalRead(r io.Reader) (err error)
- type Ident
- type Letter
- type PubHash
- type Timestamp
- type Uint16
- type Uint16s
- type Uint24
- type Uint24s
- type Uint32
- type Uint32s
- type Uint40
- type Uint40s
- type Uint64
- type Uint64s
- type Word
Constants ¶
const IdHashLen = 8
const IdLen = sha256.Size
const IdentLen = 8
const LetterLen = 1
const MaxUint24 uint32 = 1<<24 - 1
MaxUint24 is the maximum value of a 24-bit unsigned integer: 2^24 - 1.
const MaxUint40 uint64 = 1<<40 - 1
MaxUint40 is the maximum value of a 40-bit unsigned integer: 2^40 - 1.
const PubHashLen = 8
const TimestampLen = 8
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IdHash ¶
type IdHash struct {
// contains filtered or unexported fields
}
func (*IdHash) FromIdBase64 ¶
type PubHash ¶
type PubHash struct {
// contains filtered or unexported fields
}
func (*PubHash) FromPubkey ¶
func (*PubHash) FromPubkeyHex ¶
type Timestamp ¶
type Timestamp struct {
// contains filtered or unexported fields
}
func (*Timestamp) ToTimestamp ¶
type Uint16 ¶
type Uint16 struct {
// contains filtered or unexported fields
}
Uint16 is a codec for encoding and decoding 16-bit unsigned integers.
func (*Uint16) MarshalWrite ¶
MarshalWrite writes the uint16 value to the provided writer in BigEndian order.
type Uint16s ¶
type Uint16s []*Uint16
func (Uint16s) Difference ¶
Difference computes the difference of the current Uint16s slice with another Uint16s slice. The result contains only the elements that are in the current slice but not in the other slice.
func (Uint16s) Intersection ¶
Intersection computes the intersection of the current Uint16s slice with another Uint16s slice. The result contains only the elements that exist in both slices.
type Uint24 ¶
type Uint24 struct {
// contains filtered or unexported fields
}
Uint24 is a codec for encoding and decoding 24-bit unsigned integers.
func (*Uint24) MarshalWrite ¶
MarshalWrite encodes the 24-bit unsigned integer and writes it directly to the provided io.Writer. The encoding uses 3 bytes in BigEndian order.
func (*Uint24) Set ¶
Set sets the value as a 24-bit unsigned integer. If the value exceeds the maximum allowable value for 24 bits, it returns an error.
type Uint24s ¶
type Uint24s []*Uint24
func (Uint24s) Difference ¶
Difference computes the difference of the current Uint24s slice with another Uint24s slice. The result contains only the elements that are in the current slice but not in the other slice.
func (Uint24s) Intersection ¶
Intersection computes the intersection of the current Uint24s slice with another Uint24s slice. The result contains only the elements that exist in both slices.
type Uint32 ¶
type Uint32 struct {
// contains filtered or unexported fields
}
Uint32 is a codec for encoding and decoding 32-bit unsigned integers.
func (*Uint32) MarshalWrite ¶
MarshalWrite writes the uint32 value to the provided writer in BigEndian order.
type Uint32s ¶
type Uint32s []*Uint32
func (Uint32s) Difference ¶
Difference computes the difference of the current Uint32s slice with another Uint32s slice. The result contains only the elements that are in the current slice but not in the other slice.
func (Uint32s) Intersection ¶
Intersection computes the intersection of the current Uint32s slice with another Uint32s slice. The result contains only the elements that exist in both slices.
type Uint40 ¶
type Uint40 struct {
// contains filtered or unexported fields
}
Uint40 is a codec for encoding and decoding 40-bit unsigned integers.
func (*Uint40) GetInt ¶
GetInt gets the value as an int, converted from the 40-bit unsigned integer. Note: If the value exceeds the int range, it will be truncated.
func (*Uint40) MarshalWrite ¶
MarshalWrite encodes the 40-bit unsigned integer and writes it to the provided writer. The encoding uses 5 bytes in BigEndian order.
func (*Uint40) Set ¶
Set sets the value as a 40-bit unsigned integer. If the value exceeds the maximum allowable value for 40 bits, it returns an error.
type Uint40s ¶
type Uint40s []*Uint40
func (Uint40s) Difference ¶
Difference computes the difference of the current Uint40s slice with another Uint40s slice. The result contains only the elements that are in the current slice but not in the other slice.
func (Uint40s) Intersection ¶
Intersection computes the intersection of the current Uint40s slice with another Uint40s slice. The result contains only the elements that exist in both slices.
type Uint64 ¶
type Uint64 struct {
// contains filtered or unexported fields
}
Uint64 is a codec for encoding and decoding 64-bit unsigned integers.
func (*Uint64) Int ¶
Int gets the value as an int, converted from uint64. May truncate if the value exceeds the range of int.
func (*Uint64) MarshalWrite ¶
MarshalWrite writes the uint64 value to the provided writer in BigEndian order.
type Uint64s ¶
type Uint64s []*Uint64
func (Uint64s) Difference ¶
Difference computes the difference of the current Uint64s slice with another Uint64s slice. The result contains only the elements that are in the current slice but not in the other slice.
func (Uint64s) Intersection ¶
Intersection computes the intersection of the current Uint64s slice with another Uint64s slice. The result contains only the elements that exist in both slices.
type Word ¶
type Word struct {
// contains filtered or unexported fields
}
func (*Word) MarshalWrite ¶
MarshalWrite writes the word to the writer, appending the zero-byte marker