db

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All(item Item) ([][]byte, error)

Types

type BucketItem

type BucketItem interface {
	Bucket() string
}

type Item

type Item interface {
	BucketItem
	KeyValue
}

type Items

type Items interface {
	BucketItem
	KeyValues() []KeyValue
}

type KeyValue

type KeyValue interface {
	Key() string
	Value() []byte
}

type QueryOptions

type QueryOptions struct {
	Count  int
	Offset int
	Order  string
}

QueryOptions holds options for a query

type Store

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

func NewStore

func NewStore(dataDir string, contentTypes []string) (*Store, error)

func OpenUserStore

func OpenUserStore(userID string, dataDir string, contentTypes []string) (*Store, error)

func (*Store) CheckSlugForDuplicate

func (s *Store) CheckSlugForDuplicate(slug string) (string, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) ContentAll

func (s *Store) ContentAll(namespace string) [][]byte

ContentAll retrives all items from the database within the provided namespace

func (*Store) ContentByPrefix

func (s *Store) ContentByPrefix(namespace, prefix string) ([][]byte, error)

ContentByPrefix retrieves all raw byte items from the database with a specific slug prefix.

func (*Store) Delete

func (s *Store) Delete(item Item) error

func (*Store) Get

func (s *Store) Get(item Item) ([]byte, error)

func (*Store) GetIndex

func (s *Store) GetIndex(key string) ([]byte, error)

func (*Store) GetRandom added in v0.1.27

func (s *Store) GetRandom(item Item) ([]byte, error)

func (*Store) NextSequence

func (s *Store) NextSequence(item BucketItem) (uint64, error)

func (*Store) Query

func (s *Store) Query(namespace string, opts QueryOptions) (int, [][]byte)

Query retrieves a set of content from the db based on options and returns the total number of content in the namespace and the content

func (*Store) RemoveIndex

func (s *Store) RemoveIndex(slug string) error

func (*Store) Set

func (s *Store) Set(item Item) error

func (*Store) SetIndex

func (s *Store) SetIndex(item KeyValue) error

func (*Store) Sort

func (s *Store) Sort(items Items) error

Jump to

Keyboard shortcuts

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