{"id":20129071,"url":"https://github.com/theyakka/ystore","last_synced_at":"2026-01-24T22:38:42.956Z","repository":{"id":57497254,"uuid":"170027305","full_name":"theyakka/ystore","owner":"theyakka","description":"A flexible data/config file parser","archived":false,"fork":false,"pushed_at":"2022-04-24T19:09:54.000Z","size":75,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-14T04:26:45.648Z","etag":null,"topics":["configuration","configuration-files","configuration-management","content","data","database","go","key-value"],"latest_commit_sha":null,"homepage":"https://yakka.agency","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theyakka.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-10T21:06:10.000Z","updated_at":"2022-03-11T20:07:46.000Z","dependencies_parsed_at":"2022-09-03T23:51:31.658Z","dependency_job_id":null,"html_url":"https://github.com/theyakka/ystore","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/theyakka/ystore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theyakka%2Fystore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theyakka%2Fystore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theyakka%2Fystore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theyakka%2Fystore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theyakka","download_url":"https://codeload.github.com/theyakka/ystore/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theyakka%2Fystore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28738975,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T22:12:27.248Z","status":"ssl_error","status_checked_at":"2026-01-24T22:12:10.529Z","response_time":89,"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":["configuration","configuration-files","configuration-management","content","data","database","go","key-value"],"created_at":"2024-11-13T20:31:51.378Z","updated_at":"2026-01-24T22:38:42.938Z","avatar_url":"https://github.com/theyakka.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cbr/\u003e\n\u003cimg src=\"https://storage.googleapis.com/product-logos/logo_ystore.png\" width=\"70\" height=\"70\"\u003e\n\u003cbr/\u003e\nystore is a data management tool. It can be used as a generic key-value datastore, for flexible configuration storage or used as a way to import arbitrary data into your application from data files (e.g.: from a CMS or other system).\n\nThe goal of ystore's is to provide flexible access to your data.\n\n## Features\n- flexible key-value storage\n- load directly from JSON, TOML and YAML files\n- merge whole directories of files into single stores\n- simple nested key queries (e.g.: `GetString(\"node.sub.key\")`)\n- match store keys using a pattern\n- `Store` splitting and merging\n- conversion from `map` values\n\n## Memory-based Stores\n\nAt it's core, ystore is a simple **key-value** store. You can easily\ncreate a simple `Store` like so:\n\n```go\nstore := NewStore()\nstore.Set(\"color\", \"red\")\nstore.Set(\"length\", 100)\nfmt.Printf(\"The item is %s and the length is %d.\\n\", \n\tstore.GetString(\"color\"), store.GetInt(\"length\"))\n// Output: The item is red and the length is 100.\n```\n\nYou can also implement your store with default values using a the `map` initializer:\n\n```go\nstore := NewStoreFromMap(map[string]interface{}{\n\t\"color\" : green,\n\t\"length\" : 80,\n})\nfmt.Printf(\"The item is %s and the length is %d.\\n\", \n\tstore.GetString(\"color\"), store.GetInt(\"length\"))\n// Output: The item is green and the length is 80.\n```\n\n## File-based Stores\n\nLet's assume we have a `.toml` file that looks like this:\n\n```toml\n[item]\nname=\"First Item\"\ncolors=[\"red\", \"green\", \"blue\"]\nnumbers=[5, 2, 1, 6, 5]\n```\n\nWe can load the file by creating a `Store` and then using the `ReadFile` function. Note: You will need to pass the absolute file path to `ReadFile`.\n\n```go\nfilename, fileErr := filepath.Abs(\"./config.toml\")\nif fileErr != nil {\n\t// handle the path error\n\treturn\n}\nstore := NewStore()\nif readErr := store.ReadFile(filename); readErr != nil {\n\t// handle store load error\n\treturn\n}\nname := store.GetString(\"item.name\")\nnumbers := store.GetIntSlice(\"item.numbers\")\nfmt.Printf(\"The item name is '%s' and the numbers slice has %d element(s).\\n\", name, len(numbers))\n// Output: The item name is 'First Item' and the numbers slice has 5 element(s).\n```\n\n## FAQ\n\n### Can I use this as a database?\n\nYou could, but it may not be the best solution. Our goal is to provide a super flexible data management solution for a variety of application data and to not be a full scale database. A quick search on Google will find a variety of great solutions if you need to embed a database.\n\n### How is this different to Viper?\n\nFirst up, Viper is **fantastic** and super useful. ystore isn't trying to compete with viper. \n\nThe overall intent of ystore is to offer a more *generic* data mechanism, to allow files/formats to be used interchangeably, and to make it simple to just parse a bunch of it at the same time. Viper is more suited for application configuration specific task. You can still use ystore for application configuration (it works great!) but you may end up needing to do a few additional tasks yourself.  \n\n## Related\n\n[Viper](https://github.com/spf13/viper) - Go configuration with fangs\n\n## License\nystore is released under a modified MIT license. See LICENSE for details.\n\nPortions of the code are derived from other works. Please see NOTICE for details on usage and their associated licenses.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheyakka%2Fystore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheyakka%2Fystore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheyakka%2Fystore/lists"}