What problem does it solve?
GORM applications that need to scale with multiple databases often struggle to manually manage read/write routing, connection switching, and load balancing, leading to complex and error‑prone code.
Core Features & Use Cases
- Automatic routing: Writes automatically go to source databases while reads are distributed among replicas.
- Manual overrides: Developers can force reads or writes on specific connections using provided clauses.
- Transaction consistency: All operations within a transaction use the same connection, preventing accidental switching.
- Multiple resolver configurations: Different models or tables can be assigned to distinct resolver groups for sharding or domain separation.
- Custom load‑balancing policies: Plug in custom algorithms like round‑robin or weighted distribution for replica selection.
Quick Start
Configure GORM with the dbresolver plugin to route writes to the primary database and reads to replica databases.