@@ -155,14 +155,18 @@ pub struct Sharding {
155155 pub database_table_strategy : Option < StrategyType > ,
156156}
157157
158+ // There is no explicit tag identifying which variant the data contains.
159+ // Serde will try to match the data against each variant in order and the first one that deserializes successfully is the one returned.
160+ // Refrence Link: https://serde.rs/enum-representations.html
161+ // DatabaseTableStrategyConfig struct must be guaranteed to be matched firstly
158162#[ derive( Debug , Serialize , Deserialize , Clone ) ]
159163#[ serde( untagged) ]
160164pub enum StrategyType {
165+ DatabaseTableStrategyConfig ( DatabaseTableStrategyConfig ) ,
161166 DatabaseStrategyConfig ( DatabaseStrategyConfig ) ,
162- DatabaseStrategyInline ( StrategyInline ) ,
163167 TableStrategyConfig ( TableStrategyConfig ) ,
168+ DatabaseStrategyInline ( StrategyInline ) ,
164169 TableStrategyInline ( StrategyInline ) ,
165- DatabaseTableStrategyConfig ( DatabaseTableStrategyConfig ) ,
166170}
167171
168172#[ derive( Debug , Serialize , Deserialize , Clone ) ]
@@ -194,10 +198,10 @@ pub struct TableStrategyConfig {
194198#[ derive( Debug , Serialize , Deserialize , Clone ) ]
195199pub struct DatabaseTableStrategyConfig {
196200 pub database_sharding_algorithm_name : ShardingAlgorithmName ,
197- pub table_sharding_algorithm_name : ShardingAlgorithmName ,
198201 pub database_sharding_column : String ,
202+ pub table_sharding_algorithm_name : ShardingAlgorithmName ,
199203 pub table_sharding_column : String ,
200- pub shading_count : u32 ,
204+ pub sharding_count : u32 ,
201205}
202206
203207fn default_monitor_period ( ) -> u64 {
0 commit comments