local

package
v0.0.0-...-e27afb6 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupDB

func SetupDB(ctx context.Context, dirs dirset.DirectorySet) (context.Context, error)

SetupDB will setup the local database and attach it to the provided context.

Types

type DB

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

DB encapsulates the set of values

func Extract

func Extract(ctx context.Context) *DB

Extract returns the local db instance on the context (if present).

func Open

func Open(ctx context.Context, path string, passphrase string) (*DB, error)

Open opens the database at dir using the provided passphrase. We generally want a passphrase to avoid having credentials written to disk in plaintext.

func (*DB) Close

func (d *DB) Close() error

func (*DB) Credentials

func (d *DB) Credentials() *Store

func (*DB) Tokens

func (d *DB) Tokens() *Store

type Store

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

Store provides a generic key/value interface backed by badger. Stores are obtained from the database to ensure prefix do not collide.

func (*Store) Delete

func (c *Store) Delete(ctx context.Context, key string) error

func (*Store) Get

func (c *Store) Get(ctx context.Context, key string, value interface{}) (err error)

func (*Store) Put

func (c *Store) Put(ctx context.Context, key string, value interface{}) error

Jump to

Keyboard shortcuts

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