gobdb

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 5 Imported by: 2

README

gobdb

Go module that implements a go binary database

Documentation

Overview

Package gobdb provides a simple key-value database for Go binary objects encoded with encoding/gob.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithType added in v0.0.2

func WithType(t any) func(*Gobdb)

Types

type Data

type Data map[any]any

Data is a type alias for a map with keys and values of any type.

type Gobdb added in v0.0.3

type Gobdb struct {
	Data Data
	// contains filtered or unexported fields
}

Gobdb represents a simple key-value database for Go binary objects encoded with encoding/gob.

func Open

func Open(path string, opts ...option) (Gobdb, error)

Open opens a file at the specified path and decodes its contents using the gob decoder.

If the decoding fails, it returns an error. If the decoding is successful, it returns a gobdb object with the decoded data.

func (*Gobdb) Add added in v0.0.3

func (db *Gobdb) Add(d Data) error

Add append a new key-value pair of data to the db and persist data to disk using the given `path` to Open()

func (Gobdb) List added in v0.0.3

func (db Gobdb) List() Data

List returns the entire database as a map.

Jump to

Keyboard shortcuts

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