fsdb

package module
v0.0.0-...-2f0ea75 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: Unlicense Imports: 13 Imported by: 0

README

fsdb

Continuous Integration

A very simple database backed by the file system.

Usage

package main

import (
	"github.com/complex64/fsdb"
)

type Document struct{ Field string }

func main() {
	doc := Document{Field: "value"}

	db := fsdb.New("mydatadir")
	if err := db.Write(db.Key("my", "key"), doc); err != nil {
		panic(err)
	}
	// db.Read, db.ReadAll, db.Delete, ...
}

Documentation

Index

Constants

View Source
const (
	Extension = ".yaml"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

func New

func New(dataDir string) *DB

func (*DB) Delete

func (db *DB) Delete(key Key) error

func (*DB) Key

func (db *DB) Key(head string, tail ...string) Key

func (*DB) Read

func (db *DB) Read(key Key, out interface{}) (bool, error)

func (*DB) ReadAll

func (db *DB) ReadAll(key Key, keys *[]Key, values interface{}) error

func (*DB) Write

func (db *DB) Write(key Key, in interface{}) error

type Key

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

func (Key) Document

func (k Key) Document() string

func (Key) Prefix

func (k Key) Prefix() string

Jump to

Keyboard shortcuts

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