Open mtcoafun opened 7 months ago
when a dataobject use sharding, and automigrate when connect to Mysql server, it will just appear a tabel, and sharding aljust like this
ShardingAlgorithm: func(columnValue interface{}) (suffix string, err error) { if id, ok := columnValue.(uint); ok { return fmt.Sprintf("_%02d", id%shardingNum), nil } return "", fmt.Errorf("invalid column value type") }
and just migrate table {table_name}_00
{table_name}_00
when override TableName(), and just like this
TableName()
func (d *dataobject) TableName() string { return fmt.Sprintf("table_name_%02d", d.ID%shardingNum) }
and just migrate table {table_name}_00 and didnot creat any new table
Description
when a dataobject use sharding, and automigrate when connect to Mysql server, it will just appear a tabel, and sharding aljust like this
and just migrate table
{table_name}_00
when override
TableName()
, and just like thisand just migrate table
{table_name}_00
and didnot creat any new table