db

package module
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: MIT Imports: 7 Imported by: 1

README

db

Database abstractions for Snart.

Documentation

Overview

Package db contains a generic key:value database system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	Opts opts.Opts
	Impl impl.Impl
}

DB is a wrapper for a number of database implementations.

func New

func New(o opts.Opts) (*DB, error)

New creates a new DB with the given Opts.

func Open added in v0.3.0

func Open(uri string) (*DB, error)

Open creates a new DB from the given URI.

func (*DB) Close added in v0.4.1

func (d *DB) Close() error

Close wraps d.Impl.Close.

func (*DB) Del added in v0.4.1

func (d *DB) Del(k string) error

Del wraps d.Impl.Del.

func (*DB) Get added in v0.4.1

func (d *DB) Get(k string, v interface{}) error

Get wraps d.Impl.Get and json.Unmarshal.

func (*DB) Keys added in v0.4.1

func (d *DB) Keys() ([]string, error)

Keys wraps d.Impl.Keys.

func (*DB) Set added in v0.4.1

func (d *DB) Set(k string, v interface{}) error

Set wraps json.Marshal and d.Impl.Set.

func (*DB) String added in v0.3.0

func (d *DB) String() string

String returns the DB's URI, with "(table x.y.z)" appended if the Impl is a Table.

func (*DB) Table added in v0.7.2

func (d *DB) Table(k string) *DB

Table makes a new DB, with the same Opts and a Table that wraps the original Impl.

Directories

Path Synopsis
Package impl contains a DB's load/store mechanisms.
Package impl contains a DB's load/store mechanisms.
fs
Package fs contains a filesystem-based Impl.
Package fs contains a filesystem-based Impl.
mem
Package mem contains a very simple in-memory Impl.
Package mem contains a very simple in-memory Impl.
table
Package table contains an Impl that wraps a given key of another Impl.
Package table contains an Impl that wraps a given key of another Impl.
Package opts contains a DB's configuration and URI parsing.
Package opts contains a DB's configuration and URI parsing.

Jump to

Keyboard shortcuts

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