Comments (8)
I use this to do it, https://github.com/mafintosh/sublevel-prefixer and then i just use the toplevel db.
from subleveldown.
Thanks for the reply.
From the code, it looks like sublevel-prefixer
is not meant to use with nested sublevels.
Because a subleveldown prefix would be in this format sub2.db.prefix === "!sub1!!sub2!"
Just curious, is nested sublevels not a favorable choice?
from subleveldown.
You can calls to sublevel-prefixer
On Tue 4 Aug 2015 at 19:16 John Nguyen [email protected] wrote:
Thanks for the reply.
From the code, it looks like sublevel-prefixer is not meant to use with
nested sublevels.
Because a subleveldown prefix would be in this format sub2.db.prefix ===
"!sub1!!sub2!"Just curious, is nested sublevels not a favorable choice?
—
Reply to this email directly or view it on GitHub
#4 (comment)
.
from subleveldown.
- You can do subsequent calls to sublevel-prefixer
var prefix = prefixer()
prefix('hello', prefix('world', 'stuff')) // !hello!!world!stuff
from subleveldown.
ah, I see, didnt think of using the prefixer like that.
Thanks a lot @mafintosh 😄
from subleveldown.
@mafintosh how would you preserve the correct encodings on members of the batch (assuming they're different from each other or from the top level)?
from subleveldown.
@mvayngrib here is what I do.
I always use binary encoding. So whatever I save, I save in binary. For the first week I started doing that it was a headache, but it was bigger headache to work the other way :)
from subleveldown.
So the default separator used in subleveldown is !
.
Therefore to acquire the prefix:
var prefix = prefixer('!')
const k = prefix('permissions', 'my-key'); // !my-prefix!my-key
const db = await level();
const permDb = sub(
db,
'permissions',
);
db.get(k);
Does that mean k
will access the the my-key
from permDb
?
from subleveldown.
Related Issues (20)
- How to get the exception `Inner database is not open`? HOT 2
- Support buffer/Uint8Array prefixes HOT 7
- A way to get a deeply nested sublevel in one-go HOT 5
- Release v3.0.0 HOT 1
- Streams are ignoring fillCache option HOT 2
- Segfault with subleveldown HOT 27
- bytewise key-encoding on sub-level causes not found on other level HOT 20
- Adding _seek to SubIterator HOT 4
- Disable `clear()` HOT 2
- Take advantage of manifests and the squash down HOT 1
- An in-range update of abstract-leveldown is breaking the build 🚨 HOT 3
- Applies prefix twice on nested sublevel HOT 12
- An in-range update of levelup is breaking the build 🚨 HOT 2
- Remove unnecessary condition HOT 1
- Drop support of memdb
- Require deferredOpen support HOT 1
- Support "deep" option in clear() & iterator() HOT 10
- Possible issue with buffer keys HOT 10
- Decoder Err ! HOT 3
- Should the `createReadStream` method be scoped to the subs? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from subleveldown.