{"id":32523139,"url":"https://github.com/go-utils/transactions","last_synced_at":"2025-10-28T07:48:08.686Z","repository":{"id":57660021,"uuid":"325972035","full_name":"go-utils/transactions","owner":"go-utils","description":"Simply transactions","archived":false,"fork":false,"pushed_at":"2021-01-01T15:34:02.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-20T02:01:19.764Z","etag":null,"topics":["go","golang","transaction"],"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/go-utils.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":"2021-01-01T12:10:06.000Z","updated_at":"2021-01-01T15:34:04.000Z","dependencies_parsed_at":"2022-09-26T20:31:09.155Z","dependency_job_id":null,"html_url":"https://github.com/go-utils/transactions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/go-utils/transactions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-utils%2Ftransactions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-utils%2Ftransactions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-utils%2Ftransactions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-utils%2Ftransactions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-utils","download_url":"https://codeload.github.com/go-utils/transactions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-utils%2Ftransactions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281403420,"owners_count":26495042,"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","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["go","golang","transaction"],"created_at":"2025-10-28T07:48:05.443Z","updated_at":"2025-10-28T07:48:08.678Z","avatar_url":"https://github.com/go-utils.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# transactions\n\nSimply transactions\n\n# Usage\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"errors\"\n\n\t\"github.com/go-utils/transactions\"\n)\n\nvar failure = errors.New(\"failure\")\n\nfunc main() {\n\tctx := context.Background()\n\n\tonTransaction := transactions.OnTransaction(\n\t\tfunc(ctx context.Context) error {\n\t\t\treturn failure\n\t\t},\n\t)\n\n\tonRollback := transactions.OnRollback(\n\t\tfunc(ctx context.Context, err error) error {\n\t\t\tif !errors.Is(err, failure) {\n\t\t\t\treturn errors.New(\"is not `failure` error\")\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t)\n\n\ttransaction := transactions.New(onTransaction, onRollback)\n\n\n\tif err := transaction.Execute(ctx); err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n\n# License\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-utils%2Ftransactions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-utils%2Ftransactions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-utils%2Ftransactions/lists"}