value

package
v0.0.0-...-a610f59 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID struct {
	ID string `json:"id"`
}

ID provides a implementation of the Keyed interface. It can be embedded in another structure to build custom Keyed values.

func (*ID) Key

func (k *ID) Key() []byte

Key returns the key as bytes.

func (*ID) Namespace

func (k *ID) Namespace() string

Namespace is the namespace to use when storing the key.

func (*ID) String

func (k *ID) String() string

String returns the key as a string.

func (*ID) ValidKey

func (k *ID) ValidKey() error

ValidKey checks the key is valid.

type Keyed

type Keyed interface {
	// Key is the byte representation of the key.
	Key() []byte

	// Namespace is the namespace to use when storing the key.
	Namespace() string

	// ValidKey returns nil if the key is valid, otherwise ErrInvalidKey.
	ValidKey() error
}

Keyed provides a management interface for keyed values.

type Secure

type Secure struct {
	ID
	Data     []byte                 `json:"data,secure"`
	Metadata map[string]interface{} `json:"metadata"`
}

Secure provides a simple value for storing sparsely encrypted blobs and plaintext metadata.

func NewSecureValue

func NewSecureValue(id string, data []byte) *Secure

NewSecureValue returns a new Secure value.

func (*Secure) GetMetadata

func (e *Secure) GetMetadata(k string) (v interface{})

GetMetadata gets the metadata entry for k and returns it as v.

func (*Secure) SetMetadata

func (e *Secure) SetMetadata(k string, v interface{})

SetMetadata sets the metadata entry for k to v.

Jump to

Keyboard shortcuts

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