{"id":18742205,"url":"https://github.com/donuts-are-good/csvdb","last_synced_at":"2026-04-27T17:32:50.695Z","repository":{"id":218308006,"uuid":"624762473","full_name":"donuts-are-good/csvdb","owner":"donuts-are-good","description":"experimental csv database","archived":false,"fork":false,"pushed_at":"2023-04-07T15:10:24.000Z","size":9,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-04T06:42:24.850Z","etag":null,"topics":["csv","database","db","embedded","flat-file","go","golang","sql"],"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/donuts-are-good.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}},"created_at":"2023-04-07T07:41:24.000Z","updated_at":"2024-09-03T14:49:15.000Z","dependencies_parsed_at":"2024-01-21T04:57:44.662Z","dependency_job_id":null,"html_url":"https://github.com/donuts-are-good/csvdb","commit_stats":null,"previous_names":["donuts-are-good/csvdb"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/donuts-are-good/csvdb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donuts-are-good%2Fcsvdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donuts-are-good%2Fcsvdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donuts-are-good%2Fcsvdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donuts-are-good%2Fcsvdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/donuts-are-good","download_url":"https://codeload.github.com/donuts-are-good/csvdb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/donuts-are-good%2Fcsvdb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32348048,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T17:12:42.749Z","status":"ssl_error","status_checked_at":"2026-04-27T17:12:41.658Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["csv","database","db","embedded","flat-file","go","golang","sql"],"created_at":"2024-11-07T16:06:53.360Z","updated_at":"2026-04-27T17:32:50.677Z","avatar_url":"https://github.com/donuts-are-good.png","language":"Go","readme":"# CSVDB\n**WARNING:** This project doesn't have full testing yet (check `csvdb_test.go`) and should not be taken seriously or used in production. It's an experimental project being done to figure out \"What if?\".\n\n## what?\nCSVDB is a flat file database that uses CSV files as storage. Each table is a CSV file with a header row containing the column names and types like `name (type`). This project is not meant to be a production-ready database, but rather an exploration of what could be achieved using CSV files as a storage mechanism.\n\n## Installation\nClone the repository from GitHub:\n\n```bash\ngit clone https://github.com/donuts-are-good/csvdb.git\n```\n\n## Usage\n```go\nimport (\n\t\"github.com/donuts-are-good/csvdb\"\n)\n```\n\n## Setting up the Database\nWhen you open a database using csvdb.Open, the function will create a new directory at the specified path if it doesn't already exist. This directory will store the database files, including the metadata and the table files as CSVs.\n\n### To set up a new database:\n\nChoose a directory where you want to store the database files. If the directory doesn't exist, the csvdb.Open function will create it for you.\n```go\ndbPath := \"path/to/database\"\n```\nOpen the database using the csvdb.Open function. If the directory doesn't exist, this function will create it and initialize the necessary metadata files. If the directory already exists and contains a valid CSVDB structure, it will open the existing database.\n```go\ndb, err := csvdb.Open(dbPath)\nif err != nil {\n    // Handle error\n}\n```\nOnce the database is opened or created, you can create new tables, insert rows, and perform other operations as demonstrated in the usage examples below.\n\n\n## Open/Create Database\n```go\ndb, err := csvdb.Open(\"path/to/database\")\nif err != nil {\n\t// Handle error\n}\n```\n## Create Table\n```go\nerr := db.CreateTable(\"table_name\", []string{\"column1\", \"column2\"})\nif err != nil {\n\t// Handle error\n}\n```\n\n## Get Table\n```go\ntable, err := db.GetTable(\"table_name\")\nif err != nil {\n\t// Handle error\n}\n```\n## Insert Row\n```go\nerr := table.Insert([]string{\"value1\", \"value2\"})\nif err != nil {\n\t// Handle error\n}\n```\n## Upsert Row\n```go\nerr := table.Upsert([]string{\"value1\", \"value2\"})\nif err != nil {\n\t// Handle error\n}\n```\n\n## Update Rows\n```go\nerr := table.Update([]string{\"column1\"}, []string{\"new_value1\"}, map[string]string{\"column2\": \"value2\"})\nif err != nil {\n\t// Handle error\n}\n```\n## Delete Rows\n```go\nerr := table.Delete(map[string]string{\n  \"column1\": \"value1\", \n  \"column2\": \"value2\",\n  })\nif err != nil {\n\t// Handle error\n}\n```\n## Select Rows\n```go\nrows, err := table.Select([]string{\"column1\", \"column2\"}, map[string]string{\"column1\": \"value1\"})\nif err != nil {\n\t// Handle error\n}\n```\n## Execute Query\n```go\nquery := \u0026csvdb.Query{\n\tType:       \"SELECT\",\n\tTable:      \"table_name\",\n\tColumns:    []string{\"column1\", \"column2\"},\n\tConditions: map[string]string{\"column1\": \"value1\"},\n\tLimit:      10,\n\tOffset:     0,\n}\n\nrows, err := db.Execute(query)\nif err != nil {\n\t// Handle error\n}\n``````\n## Donut Shop Demo \n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/donuts-are-good/csvdb\"\n)\n\nfunc main() {\n\tdbPath := \"path/to/database\"\n\tdb, err := csvdb.Open(dbPath)\n\tif err != nil {\n\t\tfmt.Println(\"Error opening database:\", err)\n\t\treturn\n\t}\n\n\terr = db.CreateTable(\"donuts\", []string{\"id\", \"name\", \"price\"})\n\tif err != nil {\n\t\tfmt.Println(\"Error creating table:\", err)\n\t\treturn\n\t}\n\n\ttable, err := db.GetTable(\"donuts\")\n\tif err != nil {\n\t\tfmt.Println(\"Error getting table:\", err)\n\t\treturn\n\t}\n\n\t// Add new donuts\n\terr = table.Insert([]string{\"1\", \"Glazed\", \"1.00\"})\n\tif err != nil {\n\t\tfmt.Println(\"Error inserting row:\", err)\n\t\treturn\n\t}\n\n\terr = table.Insert([]string{\"2\", \"Chocolate\", \"1.50\"})\n\tif err != nil {\n\t\tfmt.Println(\"Error inserting row:\", err)\n\t\treturn\n\t}\n\n\t// Update an existing donut\n\terr = table.Update([]string{\"price\"}, []string{\"1.25\"}, map[string]string{\"id\": \"1\"})\n\tif err != nil {\n\t\tfmt.Println(\"Error updating row:\", err)\n\t\treturn\n\t}\n\n\t// List all available donuts\n\trows, err := table.Select([]string{\"id\", \"name\", \"price\"}, map[string]string{})\n\tif err != nil {\n\t\tfmt.Println(\"Error selecting rows:\", err)\n\t\treturn\n\t}\n\n\tfmt.Println(\"Available Donuts:\")\n\tfor _, row := range rows {\n\t\tfmt.Printf(\"ID: %s, Name: %s, Price: $%s\\n\", row.Values[0], row.Values[1], row.Values[2])\n\t}\n\n\t// Delete a donut\n\terr = table.Delete(map[string]string{\"id\": \"2\"})\n\tif err != nil {\n\t\tfmt.Println(\"Error deleting row:\", err)\n\t\treturn\n\t}\n\n\t// List available donuts after deletion\n\trows, err = table.Select([]string{\"id\", \"name\", \"price\"}, map[string]string{})\n\tif err != nil {\n\t\tfmt.Println(\"Error selecting rows:\", err)\n\t\treturn\n\t}\n\n\tfmt.Println(\"\\nAvailable Donuts after deletion:\")\n\tfor _, row := range rows {\n\t\tfmt.Printf(\"ID: %s, Name: %s, Price: $%s\\n\", row.Values[0], row.Values[1], row.Values[2])\n\t}\n}\n\n```\n## Contributing\nIf you're interested in contributing to this project or have any questions, please feel free to open an issue or submit a pull request. Keep in mind that this project is not meant for production use, and its primary purpose is exploration and experimentation.\n\n## License\nThis project is licensed under the MIT License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonuts-are-good%2Fcsvdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdonuts-are-good%2Fcsvdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdonuts-are-good%2Fcsvdb/lists"}