{"id":16189375,"url":"https://github.com/caolan/chicken-sublevel","last_synced_at":"2026-01-21T10:36:36.254Z","repository":{"id":19081741,"uuid":"22309255","full_name":"caolan/chicken-sublevel","owner":"caolan","description":"Namespaced access to leveldb implementations","archived":false,"fork":false,"pushed_at":"2016-07-05T07:39:59.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-07T13:51:16.323Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scheme","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/caolan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-27T11:20:38.000Z","updated_at":"2016-02-06T15:22:59.000Z","dependencies_parsed_at":"2022-09-01T10:00:14.633Z","dependency_job_id":null,"html_url":"https://github.com/caolan/chicken-sublevel","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/caolan/chicken-sublevel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fchicken-sublevel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fchicken-sublevel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fchicken-sublevel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fchicken-sublevel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caolan","download_url":"https://codeload.github.com/caolan/chicken-sublevel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caolan%2Fchicken-sublevel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28631936,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T07:35:15.004Z","updated_at":"2026-01-21T10:36:36.238Z","avatar_url":"https://github.com/caolan.png","language":"Scheme","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chicken-sublevel\n\nProvides easy namespacing of keys inside a single LevelDB database. This is\nan implementation of the [level](https://github.com/caolan/chicken-level)\nAPI.\n\n## Example use\n\n```scheme\n(use level leveldb sublevel lazy-seq)\n\n(define db (open-db \"./my-database\"))\n\n(define books (sublevel db '(\"books\")))\n(define cds (sublevel db '(\"music\" \"cds\")))\n\n(db-put books \"book1\" \"foo\")\n(db-put books \"book2\" \"bar\")\n\n(lazy-seq-\u003elist (db-stream books)) ;; =\u003e ((\"book1\" \"foo\") (\"book2\" \"bar\"))\n(lazy-seq-\u003elist (db-stream cds)) ;; =\u003e ()\n```\n\n## API\n\n### sublevel\n\n```scheme\n(sublevel db prefix)\n```\n\nWraps a level implementation with namespaced access. Keys are generated by\njoining name space strings with the `null` character.\n\n### expand-sublevels\n\n```scheme\n(expand-sublevels root db ops)\n```\n\nTakes a list of operations (as you would pass to the db-batch procedure)\nand expands the keys in the list to match the full key that would be\nwritten for the provdided sublevel(s). The key namespaces between 'root'\nand 'db' are expanded. The 'root' argument can be any level\nimplementation (eg, a raw leveldb object or another sublevel).\n\nThis can be useful if you find yourself needing to apply a transaction\nacross multiple sublevels. You can use this for each sublevel to build the\nfinal batch operations list then use db-batch on the underlying resource.\n\n```scheme\n;; Example\n(define db (open-db \"./my-database\"))\n(define sub1 (sublevel db '(\"one\")))\n(define sub2 (sublevel sub1 '(\"two\")))\n\n(expand-sublevels db sub2 '((put \"example\" \"value\")))\n;; =\u003e '((put \"one\\x00two\\x00example\" \"value\"))\n\n(expand-sublevels sub1 sub2 '((put \"example\" \"value\")))\n;; =\u003e '((put \"two\\x00example\" \"value\"))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaolan%2Fchicken-sublevel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaolan%2Fchicken-sublevel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaolan%2Fchicken-sublevel/lists"}