{"id":19506574,"url":"https://github.com/partizaans/gormreplicated","last_synced_at":"2025-09-10T21:42:17.050Z","repository":{"id":57654479,"uuid":"453999567","full_name":"partizaans/gormreplicated","owner":"partizaans","description":"This library is a complementary library for Gorm (v2) which resolves the first available pool passed to it.","archived":false,"fork":false,"pushed_at":"2022-02-01T10:12:53.000Z","size":2,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-25T22:22:20.939Z","etag":null,"topics":["go","go-orm","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","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/partizaans.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}},"created_at":"2022-01-31T12:33:30.000Z","updated_at":"2022-02-02T08:26:38.000Z","dependencies_parsed_at":"2022-09-01T01:21:53.914Z","dependency_job_id":null,"html_url":"https://github.com/partizaans/gormreplicated","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/partizaans/gormreplicated","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/partizaans%2Fgormreplicated","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/partizaans%2Fgormreplicated/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/partizaans%2Fgormreplicated/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/partizaans%2Fgormreplicated/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/partizaans","download_url":"https://codeload.github.com/partizaans/gormreplicated/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/partizaans%2Fgormreplicated/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274530951,"owners_count":25302992,"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-09-10T02:00:12.551Z","response_time":83,"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","go-orm","golang"],"created_at":"2024-11-10T22:37:40.146Z","updated_at":"2025-09-10T21:42:17.008Z","avatar_url":"https://github.com/partizaans.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gorm Replicated\n\nThis library is a complementary library for [Gorm (v2)](https://github.com/go-gorm/gorm)\nwhich resolves the first available pool passed to it.\n\n## Installation\n\n```bash\ngo get github.com/partizaans/gormreplicated\n```\n\n## Example\n\nBefore reading the example it is better to check the gorm [official docs](https://gorm.io/docs/dbresolver.html).\n\n```golang\npackage main\n\nimport (\n\t\"gorm.io/driver/mysql\"\n\t\"gorm.io/gorm\"\n\t\"gorm.io/plugin/dbresolver\"\n\n\t\"github.com/partizaans/gormreplicated\"\n)\n\nfunc main() {\n\tdb, err := gorm.Open(mysql.Open(\"db1_dsn\"), \u0026gorm.Config{})\n\n\tdb.Use(dbresolver.Register(dbresolver.Config{\n\t\t// Use `db2`, `db1` as replica options\n\t\t// It can be as many as replicas you want\n\t\t// Note that the ordering is important\n\t\tReplicas: []gorm.Dialector{mysql.Open(\"db2_dsn\"), mysql.Open(\"db1_dsn\")},\n\t\tPolicy:   gormreplicated.ReplicaPolicy{},\n\t}, \"replicas\"))\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpartizaans%2Fgormreplicated","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpartizaans%2Fgormreplicated","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpartizaans%2Fgormreplicated/lists"}