sqlite

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Store) error

Option is a function that allows configuring the store.

func WithEncryptionKey

func WithEncryptionKey(encKey *[32]byte) Option

WithEncryptionKey sets the store encryption key.

type Store

type Store struct {
	*sql.DB
	// contains filtered or unexported fields
}

func Open

func Open(ctx context.Context, path string, opts ...Option) (*Store, error)

func (*Store) Delete

func (s *Store) Delete(namespace, key string) error

Delete a key within a specific namespace. An error is returned if the key doesn't exist.

func (*Store) Get

func (s *Store) Get(namespace, key string) (ok bool, value io.Reader, err error)

Get returns the value associated with a key within a specific namespace. The returned boolean indicates whether the value was found or not.

func (*Store) Init

func (s *Store) Init(appVersion string, logger *slog.Logger) error

Init creates the database schema and initial records.

func (*Store) List

func (s *Store) List(namespace, keyPrefix string) (map[string][]string, error)

func (*Store) NewContext

func (s *Store) NewContext() context.Context

NewContext returns a new child context of the main database context.

func (*Store) Set

func (s *Store) Set(namespace, key string, value io.Reader) error

Jump to

Keyboard shortcuts

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