keys

package
v1.0.0-beta.122 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key interface {
	fmt.Stringer

	// Table is logical representation of namespace, database, and collection. Table can also be used as a random
	// bytes to group related data together.
	Table() []byte
	// IndexParts is the remaining parts of the key which is appended to the table to form a FDB key. Different packages
	// may be using this differently. The encoder in metadata package use it by adding the index identifier and value(s)
	// associated with a single or composite index. The identifier is used to differentiate whether encoding is for primary
	// key index or some other user defined index. Essentially to encode key for a given row. Some other internal packages
	// may use this as simply to form a key without any significance of index identifier.
	IndexParts() []any
	// SerializeToBytes follows the ordering of how the Key is persisted in database so to compare a Key call this method
	// get bytes and compare it with raw bytes stored in database.
	SerializeToBytes() []byte
	// CompareBytes compares the serialized form of keys. It returns 0 if p == input, -1 if p < input, and +1 if p > input.
	// A nil argument is equivalent to an empty slice.
	CompareBytes(input []byte) int
}

Key is an interface that provides an encoded key which will be used for storing Key, Value in FDB. The Key has two elements, the first set of bytes is the encoded table name and the remaining is the actual index values.

func FromBinary

func FromBinary(table []byte, fdbKey []byte) (Key, error)

func NewKey

func NewKey(table []byte, indexParts ...any) Key

NewKey returns the Key.

Jump to

Keyboard shortcuts

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