diff options
| author | the lemons <citrons@mondecitronne.com> | 2022-12-06 02:51:22 -0600 |
|---|---|---|
| committer | the lemons <citrons@mondecitronne.com> | 2022-12-06 02:51:22 -0600 |
| commit | 2731d37fe4f62b1ce9bfd7da09d1636082526fc2 (patch) | |
| tree | a565906cb973deb5e82c41c534b38d2729cc30da /README.md | |
| parent | 442acbe4ea0769d81d39c93572b859fb145b17f4 (diff) | |
add lmdb.next and pairs(db)
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -19,6 +19,9 @@ create a new environment handle and open the database at the `path`. returns the ### `lmdb.version()` returns the LMDB version as `major, minor, patch`. +### `lmdb.next(db, key)` +returns the next key-value pair after `key` in the database handle `db`, or the first key-value pair if `key` is `nil`. keys are ordered lexicographically. unlike `next`, this function does not work for traversal if, during traversal, keys are set to `nil`. (TODO: fix this somehow) + ### `env:txn_begin(write_enabled)` create a new transaction in the environment. if `write_enabled` is true, then the transaction may make modifications to the database. returns the transaction handle (`txn`) on success. @@ -32,9 +35,7 @@ flush buffers to disk. if `force` is `true`, a synchronous flush is performed ev close the environment. ### `txn:open(name, create)` -open a database in the environment. if multiple databases are to be used in the environment, `name` is the name of the database to open. otherwise, it should not be supplied. if `create` is true, the database is created if it does not exist. returns a database handle on success. - -the database handle behaves as a table that may be indexed with string keys and contains string values, read from the database. any changes made will be saved to the database when the transaction is committed. +open a database in the environment. if multiple databases are to be used in the environment, `name` is the name of the database to open. otherwise, it should not be supplied. if `create` is true, the database is created if it does not exist. returns a database handle (`db`) on success. ### `txn:drop(name)` delete the database `name` from the environment. (or clear the database, if `name` is not supplied) @@ -47,3 +48,12 @@ commit all operations of the transaction into the database. ### `txn:txn_begin()` create a nested transaction in the parent transaction. + +### `db[key]` +read the value of `key` from the database. + +### `db[key] = value` +write `value` as the value of `key` into the database. + +### `pairs(db)` +returns `lmdb.next, db, nil`. |
