{"id":13569394,"url":"https://github.com/quasilyte/gdata","last_synced_at":"2025-03-16T11:30:58.259Z","repository":{"id":205511382,"uuid":"714367711","full_name":"quasilyte/gdata","owner":"quasilyte","description":"A gamedata package that provides convenient cross-platform storage for games","archived":false,"fork":false,"pushed_at":"2024-08-30T17:28:39.000Z","size":21,"stargazers_count":27,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-16T01:53:16.569Z","etag":null,"topics":["ebiten","ebitengine","gamedev","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/quasilyte.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":"2023-11-04T17:42:51.000Z","updated_at":"2025-03-10T11:24:47.000Z","dependencies_parsed_at":"2024-01-14T03:47:32.645Z","dependency_job_id":null,"html_url":"https://github.com/quasilyte/gdata","commit_stats":null,"previous_names":["quasilyte/gdata"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quasilyte%2Fgdata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quasilyte%2Fgdata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quasilyte%2Fgdata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quasilyte%2Fgdata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quasilyte","download_url":"https://codeload.github.com/quasilyte/gdata/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243862578,"owners_count":20360170,"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":["ebiten","ebitengine","gamedev","go","golang"],"created_at":"2024-08-01T14:00:39.460Z","updated_at":"2025-03-16T11:30:57.914Z","avatar_url":"https://github.com/quasilyte.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# gdata\n\n![Build Status](https://github.com/quasilyte/gdata/workflows/Go/badge.svg)\n[![PkgGoDev](https://pkg.go.dev/badge/mod/github.com/quasilyte/gdata)](https://pkg.go.dev/mod/github.com/quasilyte/gdata)\n\nA gamedata package that provides convenient cross-platform storage for games.\n\nSome examples of such gamedata that you might want to store:\n\n* Game settings\n* Save states\n* Replays\n* Pluging/mods metadata\n\nThis package was made with [Ebitengine](https://github.com/hajimehoshi/ebiten/) in mind, but it should be usable with any kind of a game engine for Go.\n\nPlatforms supported:\n\n* Windows (file system, AppData)\n* Linux (file system, ~/.local/share)\n* MacOS (file system, ~/.local/share)\n* Android (file system, app data directory)\n* Browser/wasm (local storage)\n\nThis library tries to use the most conventional app data folder for every platform.\n\nIt provides a simple key-value style API. It can be considered to be a platform-agnostic localStorage.\n\nThis package was part of my game development framework which I used in all of my Go-powered games. Now I'm feel like it's ready to become a part of the ecosystem.\n\n## Installation\n\n```bash\ngo get github.com/quasilyte/gdata\n```\n\n## Quick Start\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/quasilyte/gdata/v2\"\n)\n\nfunc main() {\n\t// m is a data manager; treat it as a connection to a filesystem.\n\tm, err := gdata.Open(gdata.Config{\n\t\tAppName: \"mygame\",\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := m.SaveObjectProp(\"core\", \"save.data\", []byte(\"mydata\")); err != nil {\n\t\tpanic(err)\n\t}\n\tif err := m.SaveObjectProp(\"core\", \"settings.json\", []byte(\"settings\")); err != nil {\n\t\tpanic(err)\n\t}\n\n\tresult, err := m.LoadObjectProp(\"core\", \"save.data\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(\"=\u003e\", string(result)) // \"mydata\"\n\n\tfmt.Println(m.ObjectExists(\"core\"))                      // true\n\tfmt.Println(m.ObjectPropExists(\"core\", \"save.data\"))     // true\n\tfmt.Println(m.ObjectPropExists(\"core\", \"settings.json\")) // true\n\n\t{\n\t\tpropKeys, err := m.ListObjectProps(\"core\")\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tfor _, p := range propKeys {\n\t\t\tv, err := m.LoadObjectProp(\"core\", p)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tfmt.Println(\"key=\", p, \"value=\", string(v))\n\t\t}\n\t}\n\n\tfmt.Println(m.ObjectPropExists(\"core\", \"save.data\")) // true\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquasilyte%2Fgdata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquasilyte%2Fgdata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquasilyte%2Fgdata/lists"}