sharding icon indicating copy to clipboard operation
sharding copied to clipboard

High performance table sharding plugin for Gorm.

Results 29 sharding issues
Sort by recently updated
recently updated
newest added

## GORM Playground Link https://github.com/go-gorm/playground/pull/726 ## Description I create a logical table named `message`, and use two underlying sharding tables: `message_01` and `message_02`. When using go-gorm/sharding plugin alone, everything works...

Bumps [gorm.io/gorm](https://github.com/go-gorm/gorm) from 1.25.4 to 1.25.10. Commits 9d370bc Fix handling of unknown column types (#6540) 7892019 Fix panic bug in migrator due to lack of nil check for stmt.Schema (#6932)...

dependencies
go

Bumps [gorm.io/driver/mysql](https://github.com/go-gorm/mysql) from 1.5.1 to 1.5.6. Commits 9d1b8d6 Fix insert id order for mariadb d848c69 Fix set time field's precision to 0 e724f92 only trim paired single-quotes for column.DefaultValue (#143)...

dependencies
go

Bumps [gorm.io/driver/postgres](https://github.com/go-gorm/postgres) from 1.5.2 to 1.5.7. Commits 1139318 Add "boolean" as an alias for "bool" (#256) 3692119 fix: namer identifier max length (#258) 2f9abde fix: dryrun migration should run select...

dependencies
go

## Your Question 支持分库吗,即将分表分布在多个数据库上 ## The document you expected this should be explained ## Expected answer

## Why restrict the primary key of sharding to int64 and must be called "ID" I am using the latest version 0.5.3 of gorm sharding and have encountered two issues...

## Description 1. when a dataobject use sharding, and automigrate when connect to Mysql server, it will just appear a tabel, and sharding aljust like this ```go ShardingAlgorithm: func(columnValue interface{})...

```go _ = db.Use(sharding.Register(sharding.Config{ ShardingKey: "ymd", NumberOfShards: 100, PrimaryKeyGenerator: sharding.PKCustom, ShardingAlgorithm: func(columnValue any) (suffix string, err error) { parentId := cast.ToInt(columnValue) suffix = fmt.Sprintf("_%v", parentId) return }, PrimaryKeyGeneratorFn: func(tableIdx int64)...

比如我想根据主键id 自定义一个路由策略 根据一定的算法把数据路由到对应的数据库或者表 要怎么实现