{"id":16703505,"url":"https://github.com/kwakubiney/sqlite-go","last_synced_at":"2026-05-21T04:03:15.977Z","repository":{"id":38454068,"uuid":"478212000","full_name":"kwakubiney/sqlite-go","owner":"kwakubiney","description":"A naïve implementation of a hash-table indexed file storage engine.","archived":false,"fork":false,"pushed_at":"2023-09-03T17:09:58.000Z","size":1216,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-21T02:44:37.105Z","etag":null,"topics":["database","filesystem","storage"],"latest_commit_sha":null,"homepage":"","language":"Go","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/kwakubiney.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-05T16:27:21.000Z","updated_at":"2023-10-17T09:59:01.000Z","dependencies_parsed_at":"2024-11-20T00:05:43.139Z","dependency_job_id":null,"html_url":"https://github.com/kwakubiney/sqlite-go","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/kwakubiney%2Fsqlite-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwakubiney%2Fsqlite-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwakubiney%2Fsqlite-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwakubiney%2Fsqlite-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kwakubiney","download_url":"https://codeload.github.com/kwakubiney/sqlite-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243544536,"owners_count":20308173,"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","filesystem","storage"],"created_at":"2024-10-12T19:08:31.645Z","updated_at":"2026-05-21T04:03:15.915Z","avatar_url":"https://github.com/kwakubiney.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sqlite-go\nA naïve implementation of a persistent disk database using Golang.\n\n# Demo\n\n![Screen Recording 2022-05-12 at 10 56 25 PM](https://user-images.githubusercontent.com/71296367/168181665-d7616e13-2ca2-492b-a7c8-bf3376a077b4.gif)\n\n# How was it built?\n\n1) Basically, I utilize an append only file named `db` and an index file named `index` which gets created when the DB is opened by running `go run main.go`\n\n2) When inserts of rows are done, I maintain a `map` in memory to store the row `ID` as the key and the byte offset of the encoded row as the value for faster lookups during a `select`\n\n3) Index map is flushed to disk after the app is exited and loaded back in memory when the DB is up running again.\n\n# How was serialization done?\n1) I encode strings using the format `\u003cID\u003e:\u003cName\u003e:\u003cEmail\u003e` along with their lengths (in `32` bits, `big endian` format) during a single insert.\n\n2) The encoded lengths help to seek through the file to read specific rows during a `select`\n# Why?\nTo learn how disk based databases and indexes work.\n\n# How to use\nThis database supports `insert` and `select` of rows with fields `ID, Name, Email`\n\n# How to do an insert\n\n`insert \u003cID\u003e \u003cName\u003e \u003cEmail\u003e`\n\n`example` : `insert 1 Kwaku k@mail.com`\n\n# How to do a select of a specific row\n\n`select \u003cID\u003e`\n\n`example` : `select 1`\n\n# How to do a select all rows\n\n`select`\n\n`example` : `select`\n\n# Things I will do in the future\n\n1) There is no control on how large the DB file can grow so compaction must be done to limit the growth.\n2) Implement `~4KB` paging to make DB reads on disk faster and more efficient.\n3) Concurrency and all the other cool stuff\n\n...when I understand them enough\n   \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwakubiney%2Fsqlite-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkwakubiney%2Fsqlite-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwakubiney%2Fsqlite-go/lists"}