-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add doc for Row Value Expressions SPI
- Loading branch information
1 parent
3de6da6
commit 750d135
Showing
12 changed files
with
197 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
docs/document/content/user-manual/common-config/builtin-algorithm/expr.cn.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
+++ | ||
title = "行表达式" | ||
weight = 7 | ||
+++ | ||
|
||
## 使用 Groovy 语法的行表达式 | ||
|
||
类型:GROOVY | ||
|
||
可配置属性: | ||
|
||
无 | ||
|
||
## 使用标准列表的行表达式 | ||
|
||
类型:PURELIST | ||
|
||
可配置属性: | ||
|
||
无 | ||
|
||
## 操作步骤 | ||
|
||
使用需要使用 `行表达式` 的属性时, 如在 `数据分片` 功能中, 在 `actualDataNodes` 属性下指明特定的 SPI 实现的 Type Name 即可。 | ||
|
||
若 `行表达式` 不指明 SPI 的 Type Name,默认将使用 `GROOVY` 的 SPI 实现。 | ||
|
||
## 配置示例 | ||
|
||
```yaml | ||
rules: | ||
- !SHARDING | ||
tables: | ||
t_order: | ||
actualDataNodes: <PURELIST>ds_0.t_order_0, ds_0.t_order_1, ds_1.t_order_0, ds_1.t_order_1 | ||
tableStrategy: | ||
standard: | ||
shardingColumn: order_id | ||
shardingAlgorithmName: t_order_inline | ||
keyGenerateStrategy: | ||
column: order_id | ||
keyGeneratorName: snowflake | ||
defaultDatabaseStrategy: | ||
standard: | ||
shardingColumn: user_id | ||
shardingAlgorithmName: database_inline | ||
shardingAlgorithms: | ||
database_inline: | ||
type: INLINE | ||
props: | ||
algorithm-expression: <GROOVY>ds_${user_id % 2} | ||
t_order_inline: | ||
type: INLINE | ||
props: | ||
algorithm-expression: <GROOVY>t_order_${order_id % 2} | ||
keyGenerators: | ||
snowflake: | ||
type: SNOWFLAKE | ||
``` | ||
## 相关参考 | ||
- [核心概念](/docs/document/content/features/sharding/concept.cn.md) | ||
- [数据分片](/docs/document/content/dev-manual/sharding.cn.md) |
66 changes: 66 additions & 0 deletions
66
docs/document/content/user-manual/common-config/builtin-algorithm/expr.en.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
+++ | ||
title = "Row Value Expressions" | ||
weight = 7 | ||
+++ | ||
|
||
## Row Value Expressions that uses the Groovy syntax | ||
|
||
Type: GROOVY | ||
|
||
Attributes: | ||
|
||
None | ||
|
||
## Row Value Expressions that uses a standard list | ||
|
||
Type: PURELIST | ||
|
||
Attributes: | ||
|
||
None | ||
|
||
## Procedure | ||
|
||
When using attributes that require the use of `Row Value Expressions`, such as in the `data sharding` feature, it is | ||
sufficient to indicate the Type Name of the specific SPI implementation under the `actualDataNodes` attribute. | ||
|
||
If the `Row Value Expressions` does not indicate the Type Name of the SPI, the SPI implementation of `GROOVY` will be | ||
used by default. | ||
|
||
## Sample | ||
|
||
```yaml | ||
rules: | ||
- !SHARDING | ||
tables: | ||
t_order: | ||
actualDataNodes: <PURELIST>ds_0.t_order_0, ds_0.t_order_1, ds_1.t_order_0, ds_1.t_order_1 | ||
tableStrategy: | ||
standard: | ||
shardingColumn: order_id | ||
shardingAlgorithmName: t_order_inline | ||
keyGenerateStrategy: | ||
column: order_id | ||
keyGeneratorName: snowflake | ||
defaultDatabaseStrategy: | ||
standard: | ||
shardingColumn: user_id | ||
shardingAlgorithmName: database_inline | ||
shardingAlgorithms: | ||
database_inline: | ||
type: INLINE | ||
props: | ||
algorithm-expression: <GROOVY>ds_${user_id % 2} | ||
t_order_inline: | ||
type: INLINE | ||
props: | ||
algorithm-expression: <GROOVY>t_order_${order_id % 2} | ||
keyGenerators: | ||
snowflake: | ||
type: SNOWFLAKE | ||
``` | ||
## Related References | ||
- [Core Concept](/docs/document/content/features/sharding/concept.en.md) | ||
- [Data Sharding](/docs/document/content/dev-manual/sharding.en.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters