{"id":16687075,"url":"https://github.com/paralin/go-indexeddb","last_synced_at":"2025-10-31T00:31:08.884Z","repository":{"id":57493018,"uuid":"163265781","full_name":"paralin/go-indexeddb","owner":"paralin","description":"Go WASM and GopherJS bindings to IndexedDB with work-arounds for transactions \"going inactive\" due to Go's goroutine preemption.","archived":true,"fork":false,"pushed_at":"2024-05-15T22:04:41.000Z","size":66,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-14T08:51:57.485Z","etag":null,"topics":[],"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/paralin.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,"dei":null}},"created_at":"2018-12-27T08:01:37.000Z","updated_at":"2024-05-28T02:34:20.000Z","dependencies_parsed_at":"2022-08-28T11:51:16.099Z","dependency_job_id":"fd4c632e-6f8a-4366-bdc5-6f873503baca","html_url":"https://github.com/paralin/go-indexeddb","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paralin%2Fgo-indexeddb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paralin%2Fgo-indexeddb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paralin%2Fgo-indexeddb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paralin%2Fgo-indexeddb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paralin","download_url":"https://codeload.github.com/paralin/go-indexeddb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239084400,"owners_count":19578773,"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":[],"created_at":"2024-10-12T15:07:41.689Z","updated_at":"2025-10-31T00:31:03.558Z","avatar_url":"https://github.com/paralin.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IndexedDB\n\n\u003e Bindings for Go to IndexedDB for WebAssembly and GopherJS.\n\n## Deprecated\n\nIt is recommended to use the [go-indexeddb] library instead.\n\n[go-indexeddb]: https://github.com/aperturerobotics/go-indexeddb\n\n## Getting Started\n\nCheck out the [example](./example/example.go).\n\nSample:\n\n```go\n  key := []byte(\"key\")\n  val := []byte(\"test\")\n\n  err := objStore.Set(key, val)\n  err = objStore.Commit()\n\n  data, found, err := objStore.Get(key)\n  if err == nil \u0026\u0026 !found {\n    err = errors.New(\"key not found after setting it\")\n  }\n  // data contains same data as \"val\"\n\n  prefix := []byte(\"ke\")\n  err = objStore.ScanPrefix(prefix, func(key, val []byte) error {\n    fmt.Printf(\"got key/value pair: %v =\u003e %v\\n\", key, val)\n    return nil\n  })\n```\n\n## Transactions expiring\n\nIn IndexedDB, transactions will expire if inactive for a short period of time,\nor if the Go code goes inactive (such as when waiting for a select statement).\nAfter the transaction expires, all requests will panic / return an error -\n\"transaction is not active.\"\n\nThis unfortunately happens quite frequently with the Go implementation of the\nIndexedDB client in this library, because the Go wasm and/or GopherJS\nimplementations frequently unwind the stack to the event loop when switching\ngoroutines. The code will also sometimes panic if the Js code throws any errors.\n\nThe IndexedDB code in this library tries to be as minimal of a wrapper around\nthe underlying JavaScript implementations as possible. As such, the fix for\nthese issues is implemented in an additional wrapper. After constructing a\n`Database`, call NewDurableTransaction(db, scope, mode) instead of Transaction.\nIf the transaction \"goes inactive,\" it will will re-start the transaction. It\nwill also handle any panics from the calls.\n\nUnfortunately, a transaction \"going inactive\" will also commit the transaction.\nThe \"abort\" call will \"roll-back\" the changes made by the transaction. This is a\nfairly weak transaction mechanism and should not be relied upon like a\ntraditional transaction system (in BoltDB or similar).\n\nThe \"Kvtx\" implementation has a easy to use get/set API using `[]byte` slices.\nIt also implements \"ScanPrefix\" and \"ScanPrefixKeys\" for iterating over the db.\n\nReference:\nhttps://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparalin%2Fgo-indexeddb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparalin%2Fgo-indexeddb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparalin%2Fgo-indexeddb/lists"}