levelDB

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ConstLeveldbFileName = "db"

Variables

This section is empty.

Functions

func InitServer

func InitServer(dir string) error

Types

type Server

type Server interface {
	Open() error
	Close() error
	Instance() *leveldb.DB
	IsExistFromLevelDB(key string) (bool, error)
	FindByPrefix(pre string) (files map[string]string, err error)
	FindAll() (map[string]string, error)
	FindLimit(start, limit string) (data map[string]string, err error)
	BatchInsert(attr map[string]string) error
	RemoveKeyFromLevelDB(key string) error
	Insert(key string, val interface{}) error
	FindByKey(key string) (data []byte, err error)
}

func GetServer

func GetServer() Server

func NewServer

func NewServer(dir string) Server

type ServerImpl

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

func (*ServerImpl) BatchInsert

func (s *ServerImpl) BatchInsert(attr map[string]string) error

attr[key]val

func (*ServerImpl) Close

func (s *ServerImpl) Close() error

func (*ServerImpl) FindAll

func (s *ServerImpl) FindAll() (map[string]string, error)

func (*ServerImpl) FindByKey

func (s *ServerImpl) FindByKey(key string) (data []byte, err error)

func (*ServerImpl) FindByPrefix

func (s *ServerImpl) FindByPrefix(pre string) (map[string]string, error)

func (*ServerImpl) FindLimit

func (s *ServerImpl) FindLimit(start, limit string) (map[string]string, error)

比如key是key1-key1000 start = key1 limit = key2 就是从key1-key199 start = key100 limit = key105 就是从key100-key104

func (*ServerImpl) Insert

func (s *ServerImpl) Insert(key string, val interface{}) error

func (*ServerImpl) Instance

func (s *ServerImpl) Instance() *leveldb.DB

func (*ServerImpl) IsExistFromLevelDB

func (s *ServerImpl) IsExistFromLevelDB(key string) (bool, error)

func (*ServerImpl) Open

func (s *ServerImpl) Open() error

func (*ServerImpl) RemoveKeyFromLevelDB

func (s *ServerImpl) RemoveKeyFromLevelDB(key string) error

Jump to

Keyboard shortcuts

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