paths

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package paths encodes and decodes storage paths for database objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectionInfo

func CollectionInfo(prefix string) string

CollectionInfo returns the storage path for the collection info object under the given prefix.

func CollectionsPrefix

func CollectionsPrefix(prefix string) string

CollectionsPrefix returns the storage path prefix for listing all collections under the given prefix.

func FromCollection

func FromCollection(prefix string, name []byte) string

FromCollection encodes a collection name into a storage path under the given prefix.

func FromKey

func FromKey(prefix string, key []byte) string

FromKey encodes a key into a storage path under the given prefix.

func FromTransaction

func FromTransaction(prefix string, id data.TxID) string

FromTransaction encodes a transaction ID into a storage path under the given prefix.

func IsCollectionInfo

func IsCollectionInfo(p string) bool

IsCollectionInfo reports whether the given path refers to a collection info object.

func KeysPrefix

func KeysPrefix(prefix string) string

KeysPrefix returns the storage path prefix for listing all keys under the given prefix.

func ToCollection

func ToCollection(suffix string) ([]byte, error)

ToCollection decodes a collection name from its storage path suffix.

func ToKey

func ToKey(suffix string) ([]byte, error)

ToKey decodes a key from its storage path suffix.

func ToTransaction

func ToTransaction(suffix string) (data.TxID, error)

ToTransaction decodes a transaction ID from its storage path suffix.

Types

type ParseResult

type ParseResult struct {
	Prefix string
	Suffix string
	Type   Type
}

ParseResult holds the components of a parsed storage path.

func Parse

func Parse(p string) (ParseResult, error)

Parse splits a storage path into its prefix, type, and suffix components.

type Type

type Type string

Type represents the category of a storage path (e.g. key, collection, transaction).

const (
	UnknownType        Type = ""
	KeyType            Type = "_k"
	CollectionType     Type = "_c"
	TransactionType    Type = "_t"
	CollectionInfoType Type = "_i"
)

Path type constants for each category of storage object.

Jump to

Keyboard shortcuts

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