libdb

package module
v0.0.0-...-5820b00 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2020 License: MIT Imports: 9 Imported by: 1

README

libdb

Documentation

Index

Constants

View Source
const (
	C_Suffix_Split = "[PeriodMemDB]"
	C_Period_1Min  = "C_Period_1Min"
	C_Period_5Min  = "C_Period_5Min"
	C_Period_1Hour = "C_Period_1Hour"
	C_Period_1Day  = "C_Period_1Day"
)

Variables

This section is empty.

Functions

func DBClose

func DBClose() error

func DBCreate

func DBCreate(name string) (err error)

func DBDel

func DBDel(name, k string) (err error)

func DBGet

func DBGet(name, k string) (ret interface{}, err error)

func DBInit

func DBInit(dbName, path string, bDefault bool) (err error)

func DBPut

func DBPut(name, k string, v interface{}) error

func DBRange

func DBRange(name string, f func(k string, v interface{}) bool) error

func DBRangeByPrefix

func DBRangeByPrefix(name, prefix string, f func(k string, v interface{}) bool) error

func PeriodDataList

func PeriodDataList(key interface{}, fCanAppend func(pd *PeriodData) bool) []interface{}

func PeriodDataListRevert

func PeriodDataListRevert(key interface{}, fCanAppend func(pd *PeriodData) bool) []interface{}

func PushPeriodData

func PushPeriodData(key, data interface{}, fCanAppend func(t time.Time, arr []*PeriodData) bool) error

Types

type IDB

type IDB interface {
	DBClose() error
	DBDel(name, k string) error
	DBCreate(name string) error

	// for map
	DBPut(name, k string, v interface{}) error
	DBGet(name, k string) (ret interface{}, err error)
	DBRange(name string, f func(k string, v interface{}) bool) error
	DBRangeByPrefix(name, prefix string, f func(k string, v interface{}) bool) error

	// for list
	DBPush(name, v string, index int) error
	DBRemove(name string, index int) error
	DBPop(name string, index int) error
	DBRevert(name string) []string

	// help
	DBHas(name, k string) bool
	DBKeys(name string) []string
}
var (
	MemoryDB IDB
	LevelDB  IDB
	BoltDB   IDB
)

type PeriodData

type PeriodData struct {
	TN    time.Time
	Value interface{}
}

Jump to

Keyboard shortcuts

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