database

package
v0.0.0-...-9d09e4b Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteEntryDB

func DeleteEntryDB(db *Database, key string) error

DeleteEntryDB deletes a key-value pair from the Bolt Database Bucket, given the key.

func GetEntriesDB

func GetEntriesDB(db *Database) (map[string]string, error)

GetEntriesDB reads all key-value pairs from the Bolt Database Bucket.

func GetEntryDB

func GetEntryDB(db *Database, key string) (string, error)

GetEntryDB reads a key-value pair from the Bolt Database Bucket, given the key.

func PutEntryDB

func PutEntryDB(db *Database, key string, value string) error

PutEntryDB inserts a new key-value pair into the Bolt Database.

func PutMapEntriesDB

func PutMapEntriesDB(db *Database, entries map[string]string) error

PutMapEntriesDB inserts a map of key-value pairs into the Bolt Database.

Types

type Database

type Database struct {
	Bucket string
	BoltDB *bolt.DB
}

Database represents a BoltDB database object.

Contains the bucket name and the DB object for the BoltDB database.

func SetupDB

func SetupDB(dbName string, bucket string) (*Database, error)

SetupDB opens a Bolt Database and creates a Bucket for storing key-value pairs.

If the dbName file does not exist it will create it.

Jump to

Keyboard shortcuts

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