leveldb

package
v0.0.0-...-4972dd0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorDbLockFailed   = ErrorCode(1)
	ErrorDbOpenFailed   = ErrorCode(2)
	ErrorDbCreateFailed = ErrorCode(3)
)

Variables

This section is empty.

Functions

func Close

func Close() error

TODO: go routine safe.

func InitDb

func InitDb(c Config) error

此方法在整个程序中只调用一次。

func IsIntialized

func IsIntialized() bool

func NewError

func NewError(code ErrorCode, m string) error

Types

type Config

type Config struct {
	Dsn string
}

type Conn

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

func (*Conn) Get

func (conn *Conn) Get(key []byte, ro *opt.ReadOptions) ([]byte, error)

func (*Conn) Put

func (conn *Conn) Put(key, value []byte, wo *opt.WriteOptions) error

type Db

type Db struct {
	Conn *Conn
}

func GetDb

func GetDb() (*Db, error)

leveldb 协程安全,只允许创建一个链接.

type DbError

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

func (DbError) Code

func (e DbError) Code() ErrorCode

func (DbError) Error

func (e DbError) Error() string

type ErrorCode

type ErrorCode int

Jump to

Keyboard shortcuts

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