Git Product home page Git Product logo

nim-lmdb's Issues

[Question] how to get (unknown) keys of named DB

Hi,
Thanks for the library. I'm thinking this will be a big speed-up for my applications, but i'm having trouble making use of it.
I'm not seeing a proc for getting all keys of a named DB, so i'm guessing i need to get the count of key/value pairs using:

let c = txn.cursorOpen(dbi)
let key_count = c.count()

then, get the keys with something like this:

while i <= count:
  if i == 1:
    key = c.get("", op = FIRST)
  else:
    key = c.get("", op = NEXT)

  echo key

the empty string are to be a wild attempt at stumbling upon the answer via error message, as i don't see an example with anything besides a hard coded string. Also, I don't understand why the cursor needs a key to be specified to move through keys (using FIRST and NEXT) anyways.

when i try to use count(), it says the DB is not compat. so, i try to add DUPSORT to the DB and it complains that my flags have changed. I try to delete and recreate the DB, but i can't find the syntax for adding more than one dbflag when creating a new DB. I'm thinking i need DUPSORT and CREATE.

I've been at this longer than i care to admit, so any help is appreciated.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.