Added delete operation
Getty Ritter
9 years ago
| 15 | 15 | bdbGet db key = |
| 16 | 16 | db_get [] db Nothing key |
| 17 | 17 | |
| 18 | bdbDel :: Db -> ByteString -> IO () | |
| 19 | bdbDel db key = | |
| 20 | db_del [] db Nothing key | |
| 21 | ||
| 18 | 22 | -- | Open or create a database at the supplied path |
| 19 | 23 | -- using the BerkeleyDB library. |
| 20 | 24 | withBerkeleyDb :: FilePath -> (TansuDb -> IO a) -> IO a |
| 26 | 30 | db_open [DB_CREATE] DB_HASH 0 db Nothing path Nothing |
| 27 | 31 | result <- comp $ TansuDb { dbGet = bdbGet db |
| 28 | 32 | , dbSet = bdbSet db |
| 33 | , dbDel = bdbDel db | |
| 29 | 34 | , dbRunTransaction = id |
| 30 | 35 | } |
| 31 | 36 | db_close [] db |