jdb

package
v0.0.0-...-069cfaf Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2021 License: Unlicense Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JDB, _ = NewJDB(cfg.Path, nil)

Functions

func CreatePostHandler

func CreatePostHandler(w http.ResponseWriter, r *http.Request)

Create appends post path prefix for a database write

func DeletePost

func DeletePost(path, col, id string)

Delete data from the database

func DeletePostHandler

func DeletePostHandler(w http.ResponseWriter, r *http.Request)

Delete data from the database

func Host

func Host(h string) *jdb

Change host of JDB

func NewJDB

func NewJDB(path string, options *Options) (*jdb, error)

New creates a new scribble database at the desired directory location, and returns a *Driver to then use for interacting with the database

func ReadData

func ReadData(path string) [][]byte

ReadCoins reads in all coin data in and converts to bytes for unmarshalling

func ReadPost

func ReadPost(path, col, id string) mod.Post

// ReadData appends 'data' path prefix for a database read

func ReadPostCollection

func ReadPostCollection(path, col string) []mod.Post

Read all items from the database, unmarshaling the response.

func ReadPostCollectionHandler

func ReadPostCollectionHandler(w http.ResponseWriter, r *http.Request)

Rresponse Handler.

func ReadPostHandler

func ReadPostHandler(w http.ResponseWriter, r *http.Request)

// Response Handler

func UpdatePost

func UpdatePost(path, col, id string, post mod.Post) error

Update appends post path prefix for a database write

func UpdatePostHandler

func UpdatePostHandler(w http.ResponseWriter, r *http.Request)

Update appends post path prefix for a database write

Types

type Logger

type Logger interface {
	Fatal(string, ...interface{})
	Error(string, ...interface{})
	Warn(string, ...interface{})
	Info(string, ...interface{})
	Debug(string, ...interface{})
	Trace(string, ...interface{})
}

Logger is a generic logger interface

type Options

type Options struct {
	Logger // the logger scribble will use (configurable)
}

Options uses for specification of working golang-scribble

Jump to

Keyboard shortcuts

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