types

package
v1.0.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2023 License: Apache-2.0, BSD-2-Clause Imports: 8 Imported by: 13

Documentation

Index

Constants

View Source
const IdentifierLength = 32

IdentifierLength contains the byte length of a serialized Identifier.

Variables

View Source
var Void = Empty{}

Functions

This section is empty.

Types

type Empty

type Empty struct{}

type Identifier

type Identifier [IdentifierLength]byte

Identifier is a 32 byte hash value that can be used to uniquely identify some blob of data.

func NewIdentifier

func NewIdentifier(data []byte) Identifier

NewIdentifier returns a new Identifier for the given data.

func (Identifier) Alias

func (t Identifier) Alias() (alias string)

Alias returns the human-readable alias of the Identifier (or the base58 encoded bytes of no alias was set).

func (Identifier) Base58

func (t Identifier) Base58() (base58Encoded string)

Base58 returns a base58 encoded version of the Identifier.

func (Identifier) Bytes

func (t Identifier) Bytes() []byte

Bytes returns the raw bytes of the Identifier.

func (*Identifier) Decode

func (t *Identifier) Decode(data []byte) (consumed int, err error)

Decode decodes the Identifier from a sequence of bytes.

func (Identifier) Encode

func (t Identifier) Encode() (serialized []byte, err error)

Encode returns a serialized version of the Identifier.

func (*Identifier) FromBase58

func (t *Identifier) FromBase58(base58String string) (err error)

FromBase58 un-serializes an Identifier from a base58 encoded string.

func (*Identifier) FromRandomness

func (t *Identifier) FromRandomness() (err error)

FromRandomness generates a random Identifier.

func (Identifier) RegisterAlias

func (t Identifier) RegisterAlias(alias string)

RegisterAlias allows to register a human-readable alias for the Identifier which will be used as a replacement for the String method.

func (Identifier) String

func (t Identifier) String() (humanReadable string)

String returns a human-readable version of the Identifier.

func (Identifier) UnregisterAlias

func (t Identifier) UnregisterAlias()

UnregisterAlias allows to unregister a previously registered alias.

type TriBool

type TriBool uint8

TriBool represents a boolean value that can have an additional Maybe state.

const (
	// False represents the equivalent of the boolean false value.
	False TriBool = iota

	// True represents the equivalent of the boolean true value.
	True

	// Maybe represents an indeterminate where we are not entirely sure if the value is True or False.
	Maybe
)

func TriBoolFromBytes

func TriBoolFromBytes(bytes []byte) (triBool TriBool, consumedBytes int, err error)

TriBoolFromBytes unmarshals a TriBool from a sequence of bytes.

func TriBoolFromMarshalUtil

func TriBoolFromMarshalUtil(marshalUtil *marshalutil.MarshalUtil) (triBool TriBool, err error)

TriBoolFromMarshalUtil unmarshals a TriBool using a MarshalUtil (for easier unmarshaling).

func (TriBool) Bytes

func (t TriBool) Bytes() (marshaledTriBool []byte)

Bytes returns a marshaled version of the TriBool.

func (TriBool) String

func (t TriBool) String() (humanReadableTriBool string)

String returns a human readable version of the TriBool.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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