{"id":21475328,"url":"https://github.com/rinx/clj-halodb","last_synced_at":"2025-03-17T07:46:47.478Z","repository":{"id":62431445,"uuid":"173062698","full_name":"rinx/clj-halodb","owner":"rinx","description":"A clojure library for managing HaloDB embedded key-value-store.","archived":false,"fork":false,"pushed_at":"2020-07-15T12:48:39.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-14T16:47:50.762Z","etag":null,"topics":["clojure","embedded-database","key-value-store"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rinx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-28T07:24:21.000Z","updated_at":"2020-07-15T12:47:49.000Z","dependencies_parsed_at":"2022-11-01T20:46:30.087Z","dependency_job_id":null,"html_url":"https://github.com/rinx/clj-halodb","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rinx%2Fclj-halodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rinx%2Fclj-halodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rinx%2Fclj-halodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rinx%2Fclj-halodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rinx","download_url":"https://codeload.github.com/rinx/clj-halodb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243997038,"owners_count":20380980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["clojure","embedded-database","key-value-store"],"created_at":"2024-11-23T10:41:16.545Z","updated_at":"2025-03-17T07:46:47.459Z","avatar_url":"https://github.com/rinx.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clj-halodb\n\n[![Clojars Project](https://img.shields.io/clojars/v/clj-halodb.svg)](https://clojars.org/clj-halodb)\n[![GitHub Actions: lein test](https://github.com/rinx/clj-halodb/workflows/lein%20test/badge.svg)](https://github.com/rinx/clj-halodb/actions)\n\nA clojure library for managing [yahoo/HaloDB](https://github.com/yahoo/HaloDB) embedded key-value-store.\n\n## Links\n\n- [Clojars Repository](https://clojars.org/clj-halodb)\n- [cljdoc](https://cljdoc.org/d/clj-halodb)\n\n## Usage\n\n```clojure\n;; clj-halodb 0.0.2 uses yahoo/HaloDB 0.5.3\n\n[clj-halodb \"0.0.2\"]\n```\n\n```clojure\n(require '[clj-halodb.core :as halodb])\n\n(def halodb-options\n  (halodb/options\n    {:max-file-size 131072\n     :sync-write true}))\n\n(def db\n  (halodb/open \".halodb\" halodb-options))\n\n(def m {:a :b\n        ::c ::d\n        \"key\" \"val\"\n        1 2\n        1.0 2.0\n        :m {:a :b :c :d}})\n\n(halodb/put db m)\n\n(halodb/get db :a)                          ;; =\u003e \"b\"\n(halodb/get db 1)                           ;; =\u003e \"2\"\n(halodb/get db :a keyword)                  ;; =\u003e :b\n(halodb/get db 1 #(Integer/parseInt %))     ;; =\u003e 2\n\n(halodb/size db)                            ;; =\u003e 6\n\n(halodb/delete db :a)\n(halodb/get db :a)                          ;; =\u003e nil\n(halodb/size db)                            ;; =\u003e 5\n\n(halodb/put db {:x 3 :y 5 :z 6} #(- % 2))\n(-\u003e\u003e [:x :y :z]\n     (map (fn [x]\n            (halodb/get db x #(Integer/parseInt %)))))\n;; =\u003e (1 3 4)\n\n(halodb/close db)\n\n```\n\n```clojure\n;; use cheshire for encoding/decoding json\n(require '[cheshire.core :as cheshire])\n\n(halodb/put db m cheshire/generate-string)\n\n(let [parse #(cheshire/parse-string % true)]\n  (-\u003e\u003e (keys m)\n       (map #(halodb/get db % parse))))     ;; =\u003e (\"b\" \"ns/d\" \"val\" 2 2.0 {:a \"b\", :c \"d\"})\n\n```\n\n```clojure\n;; also you can use your own format like following\n\n(let [encode #(-\u003e {:t (-\u003e % type str) :v %}\n                  (cheshire/generate-string))]\n  (halodb/put db m encode))\n\n(let [decode #(let [{:keys [t v]} (cheshire/parse-string % true)]\n                (condp = t\n                  \"class clojure.lang.Keyword\" (keyword v)\n                  v))]\n  (-\u003e\u003e (keys m)\n       (map #(halodb/get db % decode))))    ;; =\u003e (:b ::d \"val\" 2 2.0 {:a \"b\", :c \"d\"})\n\n```\n\n## License\n\nCopyright © 2019 rinx\n\nThis program and the accompanying materials are made available under the\nterms of the Eclipse Public License 2.0 which is available at\nhttp://www.eclipse.org/legal/epl-2.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frinx%2Fclj-halodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frinx%2Fclj-halodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frinx%2Fclj-halodb/lists"}