leveldb

package
v0.0.0-...-0bd41fd Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Simple LevelDB Key-Value storage for chirp.

Usage: Add `import _ "github.com/yak-labs/chirp-lang/leveldb"` to your main.

```

say [set DB [leveldb.OpenFile /tmp/leveldb]]
say [$DB Put Color Magenta {}]
say [$DB Get Color {}]

say [set b [leveldb.Batch]]
$b Put D 44
$b Put E 55
$b Delete F
$DB Write $b {}

set it [$DB NewIterator {} {}]
set ok [$it Seek "!"]
while {$ok} {
	say "(( [$it Key] :: [$it Value] ))"
	set ok [$it Next]
}
$it Release

set it [leveldb.ScanAll $DB]
while {[$it Next]} {
	say "(( [$it Key] :: [$it Value] ))"
}
$it Release

set it [leveldb.ScanPrefix $DB Co]
while {[$it Next]} {
	say "(( [$it Key] :: [$it Value] ))"
}
$it Release

set it [leveldb.ScanRange $DB B T]
while {[$it Next]} {
	say "(( [$it Key] :: [$it Value] ))"
}
$it Release

```

Jump to

Keyboard shortcuts

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