{"id":18467190,"url":"https://github.com/draganm/bolted","last_synced_at":"2025-05-05T16:34:00.092Z","repository":{"id":40994122,"uuid":"285679144","full_name":"draganm/bolted","owner":"draganm","description":"Wrapper around bbolt with advanced features","archived":false,"fork":false,"pushed_at":"2023-10-25T08:01:46.000Z","size":213,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-16T17:56:26.159Z","etag":null,"topics":["bbolt","bolt","prometheus"],"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/draganm.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":"2020-08-06T21:55:04.000Z","updated_at":"2023-08-23T22:29:40.000Z","dependencies_parsed_at":"2023-02-17T21:15:40.267Z","dependency_job_id":"fcd9e124-1adf-4eb2-91a7-54aa63465589","html_url":"https://github.com/draganm/bolted","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/draganm%2Fbolted","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/draganm%2Fbolted/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/draganm%2Fbolted/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/draganm%2Fbolted/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/draganm","download_url":"https://codeload.github.com/draganm/bolted/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252533880,"owners_count":21763672,"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":["bbolt","bolt","prometheus"],"created_at":"2024-11-06T09:19:08.874Z","updated_at":"2025-05-05T16:34:00.069Z","avatar_url":"https://github.com/draganm.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bolted\n\nBolted is a lightweight and easy-to-use wrapper around [bbolt](https://github.com/etcd-io/bbolt) database, providing additional features and a more concise API.\nWith Bolted, you can work with nested buckets within transactions in a more expressive and readable manner. \nIt also offers an observer pattern for change notifications, supports Prometheus metrics for monitoring, and integrates Open Telemetry spans for tracing read and write operations.\n\n# Features\n\n* Concise Transactions: Express nested bucket operations with fewer lines of code, making your codebase more readable and maintainable.\n* Observer Pattern: Receive notifications when values of interest change within a transaction, allowing you to respond to data updates effectively.\n* [Prometheus Metrics](https://github.com/prometheus/client_golang): Monitor your database usage and performance with built-in support for publishing Prometheus metrics.\n* [Open Telemetry](https://opentelemetry.io/) Spans: Gain insights into the performance of read and write operations using Open Telemetry spans.\n\n## Why should I use it?\n\nConsider this code that will read a value and unmarshal JSON from two nested buckets:\n\n```go\npackage example\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\n\t\"go.etcd.io/bbolt\"\n)\n\nfunc ReadUser(db *bbolt.DB) (*User, error) {\n\tvar v []byte\n\n\terr := db.View(func(tx *bbolt.Tx) error {\n\t\tb1 := tx.Bucket([]byte(\"foo\"))\n\t\tif b1 == nil {\n\t\t\treturn errors.New(\"bucket 'foo' does not exist\")\n\t\t}\n\t\tb2 := b1.Bucket([]byte(\"bar\"))\n\t\tif b2 == nil {\n\t\t\treturn errors.New(\"bucket 'foo/bar' does not exist\")\n\t\t}\n\t\tvd := b2.Get([]byte(\"baz\"))\n\t\tif vd == nil {\n\t\t\treturn errors.New(\"value 'foo/bar/baz' does not exist\")\n\t\t}\n\t\tv = make([]byte, len(vd))\n\t\tcopy(v, vd)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"read tx failed: %w\", err)\n\t}\n\n\tu := \u0026User{}\n\terr = json.Unmarshal(v, u)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not parse the user: %w\", err)\n\t}\n\n\treturn u, nil\n\n}\n```\n\nand compare it to the identical code using `bolted`:\n\n```go\npackage example\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"fmt\"\n\n\t\"github.com/draganm/bolted/dbpath\"\n\t\"github.com/draganm/bolted\"\n)\n\nfunc ReadUserBolted(db bolted.Database) (*User, error) {\n\tvar v []byte\n\n\terr := db.Read(context.Background(), func(tx bolted.ReadTx) error {\n\t\tv = tx.Get(dbpath.ToPath(\"foo\", \"bar\", \"baz\"))\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"read tx failed: %w\", err)\n\t}\n\n\tu := \u0026User{}\n\terr = json.Unmarshal(v, u)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not parse the user: %w\", err)\n\t}\n\n\treturn u, nil\n\n}\n\n```\n\nyou will quickly notice that `bolted` will let you express the same semantic with 2 lines of code instead of 15.\n\n## Contributing\n\nWe welcome contributions to Bolted! If you find any issues or have ideas for improvements, feel free to open an issue or submit a pull request on [GitHub](https://github.com/draganm/bolted).\n\n\n## License\nBolted is distributed under the MIT License, making it free and open-source for anyone to use.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdraganm%2Fbolted","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdraganm%2Fbolted","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdraganm%2Fbolted/lists"}