{"id":23881780,"url":"https://github.com/zikani03/pgadvisorylock","last_synced_at":"2026-05-03T07:41:09.859Z","repository":{"id":57619399,"uuid":"383442012","full_name":"zikani03/pgadvisorylock","owner":"zikani03","description":"Go library for acquiring and releasing PostgreSQL's Advisory Locks with added support for pgx.","archived":false,"fork":false,"pushed_at":"2023-10-20T19:25:06.000Z","size":53,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-03T21:57:49.882Z","etag":null,"topics":["advisory-locks","golang","postgresql"],"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/zikani03.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,"publiccode":null,"codemeta":null}},"created_at":"2021-07-06T11:18:20.000Z","updated_at":"2023-10-20T19:25:04.000Z","dependencies_parsed_at":"2024-06-20T12:00:10.191Z","dependency_job_id":"0cbd7a22-8a76-455d-9e0b-e4b5b92ea871","html_url":"https://github.com/zikani03/pgadvisorylock","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/zikani03/pgadvisorylock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zikani03%2Fpgadvisorylock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zikani03%2Fpgadvisorylock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zikani03%2Fpgadvisorylock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zikani03%2Fpgadvisorylock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zikani03","download_url":"https://codeload.github.com/zikani03/pgadvisorylock/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zikani03%2Fpgadvisorylock/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32562118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: 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":["advisory-locks","golang","postgresql"],"created_at":"2025-01-04T01:58:56.291Z","updated_at":"2026-05-03T07:41:09.843Z","avatar_url":"https://github.com/zikani03.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"pgadvisorylock\n===\n\nGo library for acquiring and releasing [PostgreSQL's Advisory Locks](https://www.postgresql.org/docs/13/explicit-locking.html#ADVISORY-LOCKS) with added support for [pgx](https://github.com/jackc/pgx).\n\n\n## Use in your project\n\n```sh\n$ go get github.com/zikani03/pgadvisorylock\n```\n\n## Example Usage\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"github.com/zikani03/pgadvisorylock\"\n)\n\nfunc main() {\n    // conn is *sql.DB wherever you get your flavour from\n    ctx := context.Context\n    ok, id, err := pgadvisorylock.AcquireLock(conn, ctx, \"person:1\")\n    if !ok {\n        panic(\"Failed to acquire lock\")\n    }\n\n    ok, err = pgadvisorylock.ReleaseLock(conn, ctx, id)\n    if !ok {\n        panic(\"Failed to release lock\")\n    }\n\n    ok, id, err = pgadvisorylock.AcquireSharedLock(conn, ctx, \"person:1\")\n    if !ok {\n        panic(\"Failed to acquire lock\")\n    }\n\n\n    advisoryLocks, err = pgadvisorylock.FetchAdvisoryLocks(conn, ctx)\n    if err != nil {\n        panic(\"Failed to fetch locks\")\n    }\n\n    for _, l := range advisoryLocks {\n        fmt.Printf(\"LockID:%s, ClassID:%s, PID:%s\\n\", string(l.ObjectID), string(l.ClassID), string(l.PID))\n    }\n\n\n    ok, err = pgadvisorylock.ReleaseSharedLock(conn, ctx, id)\n    if !ok {\n        panic(\"Failed to release lock\")\n    }\n}\n```\n\n---\n\nCopyright (c) Zikani Nyirenda Mwase","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzikani03%2Fpgadvisorylock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzikani03%2Fpgadvisorylock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzikani03%2Fpgadvisorylock/lists"}