db

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDbHandle

func NewDbHandle()

NewDbHandle 初始化数据库

Types

type DbHandle

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

DbHandle 数据库操作对象

var Db *DbHandle

Db 数据库全局对象

func (*DbHandle) Close

func (d *DbHandle) Close() error

Close closes the leveldb

@receiver d
@return error

func (*DbHandle) Delete

func (d *DbHandle) Delete(key []byte) error

Delete deletes the given key

@receiver d
@param key
@return error

func (*DbHandle) Get

func (d *DbHandle) Get(key []byte) ([]byte, error)

Get returns the value for the given key, or returns nil if none exists

@receiver d
@param key
@return []byte
@return error

func (*DbHandle) Has

func (d *DbHandle) Has(key []byte) (bool, error)

Has return true if the given key exist, or return false if none exists

@receiver d
@param key
@return bool
@return error

func (*DbHandle) NewIteratorWithRange

func (d *DbHandle) NewIteratorWithRange(startKey []byte, limitKey []byte) (iterator.Iterator, error)

NewIteratorWithRange returns an iterator that contains all the key-values between given key ranges start is included in the results and limit is excluded.

@receiver d
@param startKey
@param limitKey
@return iterator.Iterator
@return error

func (*DbHandle) Put

func (d *DbHandle) Put(key []byte, value []byte) error

Put saves the key-values

@receiver d
@param key
@param value
@return error

Jump to

Keyboard shortcuts

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