db

package
v0.0.0-...-e537141 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DotSeparated = NewStringSeparator(".")

Functions

This section is empty.

Types

type Bytes

type Bytes interface {
	// Get retreives the value stored at key.
	Get(key ID) (value []byte, ok bool)
	// Set sets the value stored at key.
	Set(key ID, value []byte) error
}

Byte is a database that holds bytes as values at keys indexed by uint64.

type BytesDB

type BytesDB struct {
	// contains filtered or unexported fields
}

func NewBytes

func NewBytes() (b BytesDB)

func (*BytesDB) Get

func (b *BytesDB) Get(key ID) (bytes []byte, ok bool)

func (*BytesDB) Set

func (b *BytesDB) Set(key ID, bytes []byte) (err error)

type BytesMutexed

type BytesMutexed struct {
	// contains filtered or unexported fields
}

func NewBytesMutexed

func NewBytesMutexed(db Bytes) (b BytesMutexed)

func (*BytesMutexed) Get

func (b *BytesMutexed) Get(key ID) (bytes []byte, ok bool)

func (*BytesMutexed) Set

func (b *BytesMutexed) Set(key ID, bytes []byte) (err error)

type EncodedBytesDB

type EncodedBytesDB struct {
	// contains filtered or unexported fields
}

func (EncodedBytesDB) Get

func (e EncodedBytesDB) Get(key ID, v interface{}) (err error)

func (*EncodedBytesDB) Set

func (e *EncodedBytesDB) Set(key ID, v interface{}) (err error)

type Generic

type Generic interface {
	/*Get attempts to write the value stored at key into value. It may or
	  may not check whether the type of the passed in value is consistent
	  with the given key.*/
	Get(key ID, value interface{}) error
	/*Set sets value at key.*/
	Set(key ID, value interface{}) error
}

Generic is meant to be uncomplicated storage of key and value pairs where key.

type ID

type ID uint64

func (ID) String

func (id ID) String() (s string)

type IDSet

type IDSet struct {
	// contains filtered or unexported fields
}

IDSet is a set of IDs that can be used to track which IDs are associated with which types or to disallow overwriting existing values associated with a key in a database.

func NewIDSet

func NewIDSet() (id IDSet)

func (*IDSet) Add

func (id *IDSet) Add(key ID)

Add adds a key to the set.

func (*IDSet) Contains

func (id *IDSet) Contains(key ID) (contains bool)

Contains checks whether a key is present in the set.

type Key

type Key = string

func TransformKey

func TransformKey(cfg StringKeyConfig, key Key, pt PartsTransformer) (out Key, err error)

type KeyNotFound

type KeyNotFound struct {
	// contains filtered or unexported fields
}

func NewKeyNotFound

func NewKeyNotFound(s fmt.Stringer) (k KeyNotFound)

func StringKeyNotFound

func StringKeyNotFound(s string) (k KeyNotFound)

func (KeyNotFound) Error

func (k KeyNotFound) Error() (s string)

type NoRegisteredType

type NoRegisteredType struct {
	TypeID
}

func (NoRegisteredType) Error

func (n NoRegisteredType) Error() (s string)

type NoSuchID

type NoSuchID struct {
	TypeID
	ID
}

func (NoSuchID) Error

func (n NoSuchID) Error() (s string)

type OverwriteDisallowed

type OverwriteDisallowed struct {
	// contains filtered or unexported fields
}

func (OverwriteDisallowed) Error

func (o OverwriteDisallowed) Error() (s string)

type Parts

type Parts = []Key

type PartsTransformer

type PartsTransformer interface {
	TransformParts(in Parts) (out Parts)
}

type Serial

type Serial interface {
	Get(key string) []string
}

type SerialMut

type SerialMut interface {
	Serial
	Set(key string, val []string)
}

type StringKeyConfig

type StringKeyConfig interface {
	SplitParts(key Key) (Parts, error)
	JoinParts(parts Parts) Key
}

type StringSeparator

type StringSeparator struct {
	// contains filtered or unexported fields
}

func NewStringSeparator

func NewStringSeparator(sep string) (s StringSeparator)

func (StringSeparator) JoinParts

func (s StringSeparator) JoinParts(parts Parts) Key

func (StringSeparator) SplitParts

func (s StringSeparator) SplitParts(key Key) (p Parts, err error)

type TypeID

type TypeID string

type TypeMap

type TypeMap struct {
	// contains filtered or unexported fields
}

func NewTypeMap

func NewTypeMap() (t TypeMap)

func (TypeMap) Contains

func (tm TypeMap) Contains(id TypeID) (contains bool)

func (TypeMap) ContainsId

func (tm TypeMap) ContainsId(tid TypeID, id ID) (contains bool)

func (TypeMap) MustContain

func (tm TypeMap) MustContain(id TypeID) (err error)

func (TypeMap) MustContainId

func (tm TypeMap) MustContainId(tid TypeID, id ID) (err error)

type TypeMapMut

type TypeMapMut struct {
	// contains filtered or unexported fields
}

func (*TypeMapMut) AllowOverwrite

func (t *TypeMapMut) AllowOverwrite() (tm *TypeMapOverwrite)

func (*TypeMapMut) Register

func (t *TypeMapMut) Register(id TypeID) (err error)

type TypeMapOverwrite

type TypeMapOverwrite struct {
	// contains filtered or unexported fields
}

func (*TypeMapOverwrite) Register

func (t *TypeMapOverwrite) Register(id TypeID) (err error)

Jump to

Keyboard shortcuts

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