Documentation ¶
Index ¶
- Constants
- type ApplyFunc
- type DB
- func (db *DB[K, V]) Close() error
- func (db *DB[K, V]) CloseQuietly()
- func (db *DB[K, V]) DecodeKey(data []byte) (K, error)
- func (db *DB[K, V]) DecodeVal(data []byte) (V, error)
- func (db *DB[K, V]) DeleteBatch(keys ...K) error
- func (db *DB[K, V]) DeleteBatchWithWriteOpts(keys []K, wo *opt.WriteOptions) error
- func (db *DB[K, V]) EncodeKey(k K) ([]byte, error)
- func (db *DB[K, V]) EncodeVal(v V) ([]byte, error)
- func (db *DB[K, V]) ForRange(consumer func(key K, val V)) error
- func (db *DB[K, V]) ForRangeWithOpts(slice *util.Range, ro *opt.ReadOptions, consumer func(key K, val V)) error
- func (db *DB[K, V]) Get(key K) (v V, err error)
- func (db *DB[K, V]) GetWithReadOpts(key K, readOpts *opt.ReadOptions) (v V, err error)
- func (db *DB[K, V]) Put(key K, val V) error
- func (db *DB[K, V]) PutBatch(batch *leveldb.Batch) error
- func (db *DB[K, V]) PutBatchWithWriteOpts(batch *leveldb.Batch, wo *opt.WriteOptions) error
- func (db *DB[K, V]) PutWithWriteOpts(key K, val V, wo *opt.WriteOptions) error
- func (db *DB[K, V]) Seek(startKey K, consumer func(key K, val V)) error
- func (db *DB[K, V]) SetCodec(codec codec.LdbCodec[K, V])
- func (db *DB[K, V]) Size() int
- type LdbOptions
- type Option
Constants ¶
View Source
const (
// DbRelativePath leveldb relative path
DbRelativePath = "leveldb"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplyFunc ¶
type ApplyFunc func(opts *LdbOptions)
type DB ¶
func OpenDB ¶
OpenDB open a leveldb with the given name and opts As usual, when you call OpenDB(), `defer db.close ()` is used to Close it
To use bloom filter:
leveldbx.OpenDB("foo", leveldbx.WithLevelDBOpts(&opt.Options{Filter: filter.NewBloomFilter(10),}))
func (*DB[K, V]) CloseQuietly ¶ added in v1.0.7
func (db *DB[K, V]) CloseQuietly()
CloseQuietly to close level db ignore error
func (*DB[K, V]) DeleteBatch ¶
func (*DB[K, V]) DeleteBatchWithWriteOpts ¶
func (db *DB[K, V]) DeleteBatchWithWriteOpts(keys []K, wo *opt.WriteOptions) error
func (*DB[K, V]) ForRangeWithOpts ¶
func (db *DB[K, V]) ForRangeWithOpts(slice *util.Range, ro *opt.ReadOptions, consumer func(key K, val V)) error
ForRangeWithOpts for range with *util.Range and LdbOptions *util.Range can be:
&util.Range{Start: []byte("foo"), Limit: []byte("xoo")}
or can be:
util.BytesPrefix([]byte("foo-")
func (*DB[K, V]) GetWithReadOpts ¶
func (db *DB[K, V]) GetWithReadOpts(key K, readOpts *opt.ReadOptions) (v V, err error)
GetWithReadOpts get key from leveldb with read LdbOptions
func (*DB[K, V]) PutBatchWithWriteOpts ¶
func (*DB[K, V]) PutWithWriteOpts ¶
func (db *DB[K, V]) PutWithWriteOpts(key K, val V, wo *opt.WriteOptions) error
PutWithWriteOpts put key value pair to leveldb with write LdbOptions
type LdbOptions ¶ added in v1.0.4
type LdbOptions struct {
// contains filtered or unexported fields
}
LdbOptions private LdbOptions
func DefaultOptions ¶
func DefaultOptions() *LdbOptions
Click to show internal directories.
Click to hide internal directories.