database

package
v0.0.0-...-af05c19 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB represents the database struct

func New

func New(location string, memory bool, continousWrite bool, ec chan error, wd chan bool, writeInt int) *DB

New initializes a database to a given location and sets it's internal DB to an empty map or reads from file first

func (*DB) Connect

func (d *DB) Connect() error

Connect connects to file and saves it's contents to database field

func (*DB) Create

func (d *DB) Create(key string, value interface{}) error

Create creates a new record

func (*DB) Delete

func (d *DB) Delete(key string) error

Delete deletes a single entry

func (*DB) DeleteMany

func (d *DB) DeleteMany(keys ...string) map[string]interface{}

func (*DB) Disconnect

func (d *DB) Disconnect() error

Disconnect encodes database with json and saves it to location if provided

func (*DB) NewWrite

func (d *DB) NewWrite()

NewWrite sends a copy of database to write job queue

func (*DB) Read

func (d *DB) Read(key string) (interface{}, error)

Read reads from a single key

func (*DB) ReadAll

func (d *DB) ReadAll() string

ReadAll returns all entries from DB

func (*DB) ReadMany

func (d *DB) ReadMany(keys ...string) map[string]interface{}

ReadMany returns multiple keys

func (*DB) Update

func (d *DB) Update(key string, value interface{}) error

Update updates a single entry

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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