db

package
v0.0.0-...-85ec5f7 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

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

func CheckSlugForDuplicate

func CheckSlugForDuplicate(slug string) (string, error)

func Close

func Close()

Close exports the abillity to close our db file. Should be called with defer after call to Init() from the same place.

func ContentAll

func ContentAll(namespace string) [][]byte

ContentAll retrives all items from the database within the provided namespace

func Delete

func Delete(item Item) error

func Get

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

func NextSequence

func NextSequence(item BucketItem) (uint64, error)

func Query

func 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 RemoveIndex

func RemoveIndex(slug string) error

func Set

func Set(item Item) error

func SetIndex

func SetIndex(item KeyValue) error

func Sort

func Sort(items Items) error

func Start

func Start(dataDir string, contentTypes []string)

Start creates a db connection, initializes db with required info, sets secrets

func SystemInitComplete

func SystemInitComplete() bool

SystemInitComplete checks if there is at least 1 admin user in the db which would indicate that the system has been configured to the minimum required.

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

Jump to

Keyboard shortcuts

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