sqlcipher

package module
v0.0.0-...-c1743e4 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyOpen = errors.New("already open")

ErrAlreadyOpen if already open.

View Source
var ErrNotOpen = errors.New("not open")

ErrNotOpen if not open.

Functions

func SetLogger

func SetLogger(l Logger)

SetLogger sets logger for the package.

Types

type ContextLogger

type ContextLogger interface {
	Debugf(ctx context.Context, format string, args ...interface{})
	Infof(ctx context.Context, format string, args ...interface{})
	Warningf(ctx context.Context, format string, args ...interface{})
	Errorf(ctx context.Context, format string, args ...interface{})
}

ContextLogger interface used in this package with request context.

func NewContextLogger

func NewContextLogger(lev LogLevel) ContextLogger

NewContextLogger ...

type DB

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

DB is sqlcipher implementation of dstore.Documents.

func New

func New() *DB

New creates a DB.

func (*DB) Close

func (d *DB) Close()

Close the db.

func (*DB) Collections

func (d *DB) Collections(ctx context.Context, parent string) ([]*dstore.Collection, error)

Collections ...

func (*DB) Create

func (d *DB) Create(ctx context.Context, path string, values map[string]interface{}) error

Create entry.

func (*DB) Delete

func (d *DB) Delete(ctx context.Context, path string) (bool, error)

Delete value at path.

func (*DB) DeleteAll

func (d *DB) DeleteAll(ctx context.Context, paths []string) error

DeleteAll paths.

func (*DB) DeleteCollection

func (d *DB) DeleteCollection(ctx context.Context, parent string) error

DeleteCollection to at paths at parent.

func (*DB) DocumentIterator

func (d *DB) DocumentIterator(ctx context.Context, parent string, opt ...dstore.Option) (dstore.Iterator, error)

DocumentIterator ...

func (*DB) Documents

func (d *DB) Documents(ctx context.Context, parent string, opt ...dstore.Option) ([]*dstore.Document, error)

Documents ...

func (*DB) Exists

func (d *DB) Exists(ctx context.Context, path string) (bool, error)

Exists returns true if the db row exists at path

func (*DB) Get

func (d *DB) Get(ctx context.Context, path string) (*dstore.Document, error)

Get entry at path.

func (*DB) GetAll

func (d *DB) GetAll(ctx context.Context, paths []string) ([]*dstore.Document, error)

GetAll paths.

func (*DB) IsOpen

func (d *DB) IsOpen() bool

IsOpen returns true if open.

func (*DB) Load

func (d *DB) Load(ctx context.Context, path string, v interface{}) (bool, error)

Load path into value.

func (*DB) OpenAtPath

func (d *DB) OpenAtPath(ctx context.Context, path string, key SecretKey) error

OpenAtPath opens db located at path.

func (*DB) Set

func (d *DB) Set(ctx context.Context, path string, values map[string]interface{}, opt ...dstore.SetOption) error

Set saves document to the db at key.

func (*DB) SetClock

func (d *DB) SetClock(clock tsutil.Clock)

SetClock sets clock.

func (*DB) Spew

func (d *DB) Spew(w io.Writer) error

Spew ...

type LogLevel

type LogLevel int

LogLevel ...

const (
	// DebugLevel ...
	DebugLevel LogLevel = 3
	// InfoLevel ...
	InfoLevel LogLevel = 2
	// WarnLevel ...
	WarnLevel LogLevel = 1
	// ErrLevel ...
	ErrLevel LogLevel = 0
)

type Logger

type Logger interface {
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
}

Logger interface used in this package.

func NewLogger

func NewLogger(lev LogLevel) Logger

NewLogger ...

type SecretKey

type SecretKey *[32]byte

SecretKey for database.

Jump to

Keyboard shortcuts

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