dbkey

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: Apache-2.0 Imports: 3 Imported by: 11

Documentation

Overview

Package dbkey provides some common utility code for working with key-value stores that use prefixes to partition the key space.

Index

Constants

View Source
const PrefixLen = 6

PrefixLen is the length in bytes of the prefixes generated by this package.

Variables

This section is empty.

Functions

This section is empty.

Types

type Prefix

type Prefix string

Prefix is a prefix that defines a subset of the keys of a key-value store. Any string can be a valid prefix, including "".

func (Prefix) Add

func (p Prefix) Add(s string) string

Add returns a copy of s with the representation of p prepended to it.

func (Prefix) Keyspace

func (p Prefix) Keyspace(name string) Prefix

Keyspace creates a keyspace prefix based on p, using name. Derived prefixes are always PrefixLen bytes long.

func (Prefix) Remove

func (p Prefix) Remove(s string) string

Remove returns a copy of s with the representation of p removed from it.

func (Prefix) String

func (p Prefix) String() string

String renders p as a hexadecimal string.

func (Prefix) Sub

func (p Prefix) Sub(name string) Prefix

Sub creates a subspace prefix based on p, using name. Derived prefixes are always PrefixLen bytes long.

Jump to

Keyboard shortcuts

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