We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
in most time table's sharding rule is same like:
` defaultTableStrategy: standard: shardingColumn: id shardingAlgorithm: type: INLINE props: algorithm.expression: ${LogicTableName}${id % 2}
`
so if algorithm.expression include LogicTableName ,most of table can use defaultTableStrategy
just add code in InlineShardingAlgorithm like this: `
@Override public String doSharding(final Collection<String> availableTargetNames, final PreciseShardingValue<Comparable<?>> shardingValue) { Preconditions.checkNotNull(properties.get(ALGORITHM_EXPRESSION), "Inline sharding algorithm expression cannot be null."); String algorithmExpression = InlineExpressionParser.handlePlaceHolder(properties.get(ALGORITHM_EXPRESSION).toString().trim()); Closure<?> closure = new InlineExpressionParser(algorithmExpression).evaluateClosure(); Closure<?> result = closure.rehydrate(new Expando(), null, null); result.setResolveStrategy(Closure.DELEGATE_ONLY); result.setProperty(shardingValue.getColumnName(), shardingValue.getValue()); result.setProperty("LogicTableName", shardingValue.getLogicTableName()); return result.call().toString(); }
The text was updated successfully, but these errors were encountered:
Thanks for your suggestion, but IMO it's unneccessary now.
Sorry, something went wrong.
No branches or pull requests
in most time table's sharding rule is same like:
`
defaultTableStrategy:
standard:
shardingColumn: id
shardingAlgorithm:
type: INLINE
props:
algorithm.expression: ${LogicTableName}${id % 2}
`
so if algorithm.expression include LogicTableName ,most of table can use defaultTableStrategy
just add code in InlineShardingAlgorithm like this:
`
`
The text was updated successfully, but these errors were encountered: