bbolt

package
v0.0.0-...-ebfccbf Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

bbolt represents a bbolt extension for the why server. bbolt is a key-value storage that can be used to persistently store and access data in why.

Set data:

bbolt.set("users", "test@test.com", { name: "John Do", age: 23 })

Get data:

user := bbolt.get("users", "test@test.com")

name := user.name
age  := user.age

Iterate over data:

bbolt.iterate("users", func(key, value) {
   email := key
   name  := value.name
   age   := value.age

   return true // return false if you want to stop the iteration
})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Extension

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

Extension represents the bbolt extension for the why server.

func New

func New(file string, options *bbolt.Options) (*Extension, error)

New creates a new bbolt extension instance.

func (*Extension) Bolt

func (e *Extension) Bolt() *bbolt.DB

Bolt returns the connection to bbolt. This can be useful if you setup your own server and add the extension manually. This way you can access bolt directly and insert data from within your backend.

func (*Extension) Hook

func (e *Extension) Hook(sc *script.Compiled, w io.Writer, resp http.ResponseWriter, r *http.Request) error

Hook will add a variable called 'bbolt' to the script runtime that contains functions to access bbolt.

func (*Extension) Init

func (e *Extension) Init() error

Init inits the bbolt extension.

func (*Extension) Name

func (e *Extension) Name() string

Name returns the name of the bbolt extension.

func (*Extension) Shutdown

func (e *Extension) Shutdown() error

Shutdown closes the bbolt extension.

func (*Extension) Vars

func (e *Extension) Vars() []string

Vars returns all the variables bbolt will globally create

Jump to

Keyboard shortcuts

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