state

package
v0.0.0-...-f8b7a73 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("ErrorNotFound")

如果没有从数据库返回结果,则返回errnotfound。

Functions

This section is empty.

Types

type DBStore

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

dbstore使用leveldb存储值。

func NewDBStore

func NewDBStore(path string) (s *DBStore, err error)

new dbstore创建dbstore的新实例。

func NewInmemoryStore

func NewInmemoryStore() *DBStore

newInMemoryStore返回dbstore的新实例。仅用于测试和模拟。

func (*DBStore) Close

func (s *DBStore) Close() error

close释放基础级别db使用的资源。

func (*DBStore) Delete

func (s *DBStore) Delete(key string) (err error)

删除删除存储在特定键下的条目。

func (*DBStore) Get

func (s *DBStore) Get(key string, i interface{}) (err error)

get检索特定键的持久化值。如果没有结果 返回errnotfound。提供的参数应为字节片或 实现encoding.binaryUnmarshaler接口的结构

func (*DBStore) Put

func (s *DBStore) Put(key string, i interface{}) (err error)

Put存储为特定键实现二进制的对象。

type Store

type Store interface {
	Get(key string, i interface{}) (err error)
	Put(key string, i interface{}) (err error)
	Delete(key string) (err error)
	Close() error
}

存储区定义获取、设置和删除不同键的值所需的方法 关闭基础资源。

Jump to

Keyboard shortcuts

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