{"id":13441042,"url":"https://github.com/gfredericks/quinedb","last_synced_at":"2025-10-23T18:29:13.514Z","repository":{"id":137791953,"uuid":"67936193","full_name":"gfredericks/quinedb","owner":"gfredericks","description":"QuineDB is a quine that is also a key-value store.","archived":false,"fork":false,"pushed_at":"2017-07-29T17:25:23.000Z","size":33,"stargazers_count":580,"open_issues_count":5,"forks_count":23,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-29T15:08:56.623Z","etag":null,"topics":["database","quine"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gfredericks.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-09-11T15:02:41.000Z","updated_at":"2025-02-12T19:05:42.000Z","dependencies_parsed_at":"2023-05-22T14:00:08.131Z","dependency_job_id":null,"html_url":"https://github.com/gfredericks/quinedb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gfredericks%2Fquinedb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gfredericks%2Fquinedb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gfredericks%2Fquinedb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gfredericks%2Fquinedb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gfredericks","download_url":"https://codeload.github.com/gfredericks/quinedb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247361691,"owners_count":20926643,"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":["database","quine"],"created_at":"2024-07-31T03:01:29.210Z","updated_at":"2025-10-23T18:29:13.440Z","avatar_url":"https://github.com/gfredericks.png","language":"Shell","funding_links":[],"categories":["HarmonyOS","Miscellaneous"],"sub_categories":["Windows Manager"],"readme":"\u003cimg src=\"logo2.png\" title=\"logo\" align=\"right\" /\u003e\n\n# QuineDB\n\n[![Build Status](https://travis-ci.org/gfredericks/quinedb.svg?branch=master)](https://travis-ci.org/gfredericks/quinedb)\n\nQuineDB is a quine that is also a key/value store.\n\n_If your database can't print its own source code,\ncan you really trust it?_\n\n## Getting Started\n\nQuineDB consists of the `quinedb` script in this repository. It\nis written in Bash and requires Bash 4.\n\nWhen you run it, the (possibly modified) source code of `quinedb` is\nprinted to `STDOUT`, and the results of the specific command run are\nprinted to `STDERR`. Therefore, each time you run a write operation\nyou must redirect `STDOUT` to an appropriate place.  For consistency,\nwe recommend doing this for all operations. However this can be very\ntedious to do directly, so a bash function such as the following can\nbe helpful, and the examples that follow will make use of it:\n\n``` shell\nqdb () {\n  ./quinedb \"$@\" \u003e qdb.out 2\u003e qdb.err || return \"$?\"\n  cat qdb.out \u003e quinedb\n  cat qdb.err\n  rm qdb.err qdb.out\n}\n```\n\n### API\n\nQuineDB has four commands: `get`, `set`, `delete`, and `keys`.\n\n#### `set`\n\nTo set a key to a value, use `quinedb set \u003ck\u003e \u003cv\u003e`:\n\n``` shell\n$ qdb set foo bar\nOK\n$ qdb set count 42\nOK\n```\n\n#### `get`\n\nTo get a value, use `quinedb get \u003ck\u003e`:\n\n``` shell\n$ qdb get foo\nbar\n```\n\n#### `keys`\n\nTo list the keys in the database, use `quinedb keys`:\n\n``` shell\n$ qdb keys\ncount\nfoo\n```\n\n#### `delete`\n\nTo delete a key, use `quinedb delete \u003ck\u003e`:\n\n``` shell\n$ qdb delete foo\nOK\n$ qdb keys\ncount\n```\n\n### Syntax\n\nKeys and values are printed in the syntax of bash strings, which\nallows `keys` to print one key on each line unambiguously (even if a\nkey contains a newline) and `get` to unambiguously print no output for\na missing key.\n\n``` shell\n$ qdb set \\\n  $'this\\nkey\\nhas\\nfour\\nlines' \\\n  $'and the \\'value\\' has \\\"quotes\\\"'\nOK\n\n$ qdb set empty ''\nOK\n\n$ qdb keys\n$'this\\nkey\\nhas\\nfour\\nlines'\nempty\n\n$ qdb get $'this\\nkey\\nhas\\nfour\\nlines'\n$'and the \\'value\\' has \\\"quotes\\\"'\n\n$ qdb get empty\n$''\n\n$ qdb get missing\n\n```\n\n### Transactions\n\nTo group several operations into an atomic transaction you can simply\nchain operations by redirecting `STDOUT` to an invocation of\n`/usr/bin/env bash` like so:\n\n``` shell\n$ ./quinedb set k1 v1 | \\\n/usr/bin/env bash -s set k2 v2 | \\\n/usr/bin/env bash -s set k3 v3 | \\\n/usr/bin/env bash -s keys \u003e tmp; chmod +x tmp; mv tmp quinedb\nOK\nOK\nOK\nk1\nk3\nk2\n```\n\n## FAQ\n\n### Why should my database be a quine?\n\n1. Why _shouldn't_ your database be a quine?\n2. If your data and the database code are not stored in the same\n   place, you risk losing track of one, making the other useless.\n3. You can store various versions of your database, or even fork it,\n   with no extra effort.\n\n### How fast does it go?\n\nI was able to insert 100 k/v pairs into an empty database in a mere 10\nseconds. The runtime of each operation is (probably) proportional to\nO(n·log(n)), so it's not too surprising that inserting 1000 k/v pairs\ntook over 11 minutes. If you need the database to be fast, we\nrecommend not putting too much data in it.\n\n### Are the keys and values unicode strings or arbitrary binary data?\n\nI'm not sure. How does bash work exactly?\n\n### How many concurrent connections can I have?\n\nI'm not sure you've been paying attention.\n\n### Can I run a QuineDB cluster?\n\nWell I mean, um.\n\n## Contributing\n\nPull requests are welcome.\n\n## Acknowledgments\n\n- [@timgaleckas](https://github.com/timgaleckas) for reviewing and\n  coming up with the mechanism for transactions\n\n## License\n\nCopyright © 2016 Gary Fredericks\n\nDistributed under the Eclipse Public License either version 1.0 or (at\nyour option) any later version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgfredericks%2Fquinedb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgfredericks%2Fquinedb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgfredericks%2Fquinedb/lists"}