Commit 17e4176fe606e91d0b3ce1a45ba33e4c8e27c9a2
make readme example true
Dominic Tarr committed on 11/22/2016, 10:07:15 PMParent: e1f08b9f6b33bcbfe8d6b98aa85d9c0c6c3d5379
Files changed
README.md | changed |
README.md | ||
---|---|---|
@@ -3,26 +3,35 @@ | ||
3 | 3 … | A flumeview implemented on top of level. |
4 | 4 … | |
5 | 5 … | Provides indexes which are persistent and can be streamed in order. |
6 | 6 … | |
7 | -Work In Progress. | |
8 | 7 … | |
9 | 8 … | ## example |
10 | 9 … | |
11 | 10 … | ``` js |
12 | 11 … | flumedb.use(name, function (value) { |
13 | - return data.foo | |
12 … | + return [data.foo] // must return an array | |
14 | 13 … | }) |
15 | 14 … | |
16 | 15 … | flumedb.append({foo: 'bar'}, function (err) { |
17 | 16 … | if(err) throw err |
18 | - flumedb.get('bar', function (err, value) { | |
17 … | + | |
18 … | + //query items from the index directly | |
19 … | + flumedb[name].get('bar', function (err, value) { | |
19 | 20 … | if(err) throw err |
20 | 21 … | console.log(value) // => {foo: 'bar'}) |
21 | 22 … | }) |
23 … | + | |
24 … | + //or query ranges via pull-streams | |
25 … | + pull( | |
26 … | + flumedb[name].read({gte: 'bar', live: true}), | |
27 … | + ... | |
28 … | + ) | |
29 … | + | |
22 | 30 … | }) |
23 | 31 … | ``` |
24 | 32 … | |
25 | 33 … | ## License |
26 | 34 … | |
27 | 35 … | MIT |
28 | 36 … | |
37 … | + |
Built with git-ssb-web