{"id":19541213,"url":"https://github.com/ysbaddaden/pool","last_synced_at":"2025-06-19T05:33:50.835Z","repository":{"id":53066079,"uuid":"46448407","full_name":"ysbaddaden/pool","owner":"ysbaddaden","description":"Generic (connection) pools for Crystal","archived":false,"fork":false,"pushed_at":"2023-02-08T17:24:47.000Z","size":12,"stargazers_count":76,"open_issues_count":2,"forks_count":11,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-26T16:46:06.589Z","etag":null,"topics":["crystal"],"latest_commit_sha":null,"homepage":null,"language":"Crystal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ysbaddaden.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2015-11-18T21:23:50.000Z","updated_at":"2025-01-30T00:54:25.000Z","dependencies_parsed_at":"2025-04-26T16:43:29.896Z","dependency_job_id":null,"html_url":"https://github.com/ysbaddaden/pool","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/ysbaddaden/pool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysbaddaden%2Fpool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysbaddaden%2Fpool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysbaddaden%2Fpool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysbaddaden%2Fpool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ysbaddaden","download_url":"https://codeload.github.com/ysbaddaden/pool/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysbaddaden%2Fpool/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260693871,"owners_count":23047727,"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":["crystal"],"created_at":"2024-11-11T03:09:19.227Z","updated_at":"2025-06-19T05:33:45.817Z","avatar_url":"https://github.com/ysbaddaden.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pool\n\nGeneric (connection) pools for Crystal\n\n## Getting Started\n\nA pool tailored for sharing connections across coroutines.\n\nConnections will be checkout from the pool and tied to the current fiber, until\nthey are checkin, and thus be usable by another coroutine. Otherwise they behave\nthe same than the generic pool.\n\n```crystal\nrequire \"pg\"\nrequire \"pool/connection\"\n\npg = ConnectionPool.new(capacity: 25, timeout: 0.01) do\n  PG.connect(ENV[\"DATABASE_URL\"])\nend\n```\n\nYou may checkout as many connections in parallel as needed, then checkin the\nconnections as required:\n\n```crystal\nconn = pg.checkout\nresult = conn.exec(\"SELECT * FROM posts\")\npg.checkin(conn)\n```\n\nYou may checkout a single connection per coroutine. Trying to checkout another\none will always return the same single connection:\n\n```crystal\nconn = pg.connection\nresult = conn.exec(\"SELECT * FROM posts\")\npg.release\n```\n\nYou may also use a block, so the connection will be checkin back into the pool,\nunless the connection was already checkout, in which case it will be passed to\nthe block, but not returned to the pool:\n\n```crystal\npg.connection do |conn|\n  result = conn.exec(\"SELECT * FROM posts\")\nend\n```\n\n## License\n\nLicensed under the Apache License, Version 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fysbaddaden%2Fpool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fysbaddaden%2Fpool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fysbaddaden%2Fpool/lists"}