db

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2017 License: BSD-3-Clause Imports: 9 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *bolt.DB

DB is bolt.DB for operating database.

Functions

func Count added in v0.2.0

func Count(tx *bolt.Tx, bucket string, prefix []byte) (int, error)

Count counts #data whose key has prefix.

func Del added in v0.2.0

func Del(tx *bolt.Tx, bucket string, key []byte) error

Del deletes one key-value pair.

func DelMap added in v0.2.0

func DelMap(tx *bolt.Tx, bucket string, key []byte, val string) error

DelMap deletes val from map[string]struct{} type value.

func Get added in v0.2.0

func Get(tx *bolt.Tx, bucket string, key []byte, value interface{}) ([]byte, error)

Get gets one value from db and converts it to value type.

func GetMap added in v0.2.0

func GetMap(tx *bolt.Tx, bucket string, key []byte) (map[string]struct{}, error)

GetMap gets map[string]struct{} value.

func GetPrefixs added in v0.2.0

func GetPrefixs(tx *bolt.Tx, bucket string) ([]string, error)

GetPrefixs get string prefixs of keys.

func GetStrings added in v0.2.0

func GetStrings(tx *bolt.Tx, bucket string, prefix []byte) ([]string, error)

GetStrings returns string values whose key has prefix.

func HasKey added in v0.2.0

func HasKey(tx *bolt.Tx, bucket string, key []byte) (bool, error)

HasKey returns true if db has key.

func HasVal added in v0.2.0

func HasVal(tx *bolt.Tx, bucket string, key []byte, val string) bool

HasVal returns true if map[string]struct{} type values has val.

func KeyStrings added in v0.2.0

func KeyStrings(tx *bolt.Tx, bucket string) ([]string, error)

KeyStrings returns string keys.

func MapKeys added in v0.2.0

func MapKeys(tx *bolt.Tx, bucket string, key []byte) ([]string, error)

MapKeys returns []string from keys of map[string]struct{} type value

func MustTob added in v0.2.0

func MustTob(v interface{}) []byte

MustTob is Tob , except that this fatals when error.

func Put added in v0.2.0

func Put(tx *bolt.Tx, bucket string, key []byte, value interface{}) error

Put sets one key/value pair.

func PutMap added in v0.2.0

func PutMap(tx *bolt.Tx, bucket string, key []byte, val string) error

PutMap adds val to map[string]struct{} type value.

func Setup

func Setup()

Setup setups db.

func ToKey added in v0.2.0

func ToKey(v ...interface{}) []byte

ToKey makes key of db from v.

func Tob added in v0.2.0

func Tob(v interface{}) ([]byte, error)

Tob returns an 8-byte big endian representation of v.

Types

This section is empty.

Jump to

Keyboard shortcuts

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