gorm-sharding
CommunityScale databases horizontally with shard routing
Software Engineering#postgresql#sharding#mysql#gorm#snowflake#horizontal-scaling#primary-key-generation
Authorliurida
Version1.0.0
Installs0
System Documentation
What problem does it solve?
The GORM sharding plugin routes database operations to the correct physical shard for horizontally partitioned tables, preventing ambiguous queries, failed operations, and inconsistent primary key generation across distributed datasets.
Core Features & Use Cases
- Plugin-based interception: Automatically rewrites GORM queries to target shard-specific tables based on a sharding key.
- Customizable routing: Supports modulo-based routing and user-defined sharding algorithms for complex distribution rules.
- Shard-aware primary keys: Integrates with generators like Snowflake or PostgreSQL sequences to provide globally unique IDs across shards.
- Operational guidance: Requires pre-creating shard tables, always including the sharding key in WHERE clauses to avoid ErrMissingShardingKey, and avoiding cross-shard joins by design.
- Use Case: Scale an orders table across 64 shards so each user's orders are routed to and queried from a single shard, improving write throughput and storage distribution.
Quick Start
Register the GORM sharding plugin with ShardingKey set to user_id, choose NumberOfShards, create the per-shard tables, and then run your normal Create/Read/Update/Delete operations including the sharding key.
Dependency Matrix
Required Modules
None requiredComponents
references
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: gorm-sharding Download link: https://github.com/liurida/gorm-development-skill/archive/main.zip#gorm-sharding Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.