This is an automated email from the ASF dual-hosted git repository.
jianglongtao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 7e688039a5b Add `CREATE ENCRYPT RULE` docs. (#20265)
7e688039a5b is described below
commit 7e688039a5b6b011adf17725160503de7d391396
Author: Jieker <[email protected]>
AuthorDate: Fri Aug 19 00:33:38 2022 +0800
Add `CREATE ENCRYPT RULE` docs. (#20265)
* Add `CREATE ENCRYPT RULE` docs.
* problem fixed.
---
.../rdl/rule-definition/encrypt/_index.cn.md | 7 +++
.../rdl/rule-definition/encrypt/_index.en.md | 7 +++
.../encrypt/create-encrypt-rule.cn.md | 71 ++++++++++++++++++++++
.../encrypt/create-encrypt-rule.en.md | 71 ++++++++++++++++++++++
.../create-readwrite-splitting-rule.cn.md | 2 +-
.../create-readwrite-splitting-rule.en.md | 2 +-
.../reference/distsql/syntax/reserved-word.cn.md | 6 +-
.../reference/distsql/syntax/reserved-word.en.md | 6 +-
8 files changed, 168 insertions(+), 4 deletions(-)
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/encrypt/_index.cn.md
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/encrypt/_index.cn.md
new file mode 100644
index 00000000000..5ea090b010c
--- /dev/null
+++
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/encrypt/_index.cn.md
@@ -0,0 +1,7 @@
++++
+title = "数据加密"
+weight = 1
+chapter = true
++++
+
+本章节将对数据加密特性的语法进行详细说明。
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/encrypt/_index.en.md
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/encrypt/_index.en.md
new file mode 100644
index 00000000000..c4955cb55c9
--- /dev/null
+++
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/encrypt/_index.en.md
@@ -0,0 +1,7 @@
++++
+title = "Encrypt"
+weight = 1
+chapter = true
++++
+
+This chapter describes the syntax of encrypt.
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/encrypt/create-encrypt-rule.cn.md
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/encrypt/create-encrypt-rule.cn.md
new file mode 100644
index 00000000000..54cf68fa53e
--- /dev/null
+++
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/encrypt/create-encrypt-rule.cn.md
@@ -0,0 +1,71 @@
++++
+title = "CREATE ENCRYPT RULE"
+weight = 2
++++
+
+## 描述
+
+`CREATE ENCRYPT RULE` 语法用于创建数据加密规则
+
+### 语法定义
+
+```sql
+CreateEncryptRule ::=
+ 'CREATE' 'ENCRYPT' 'RULE' encryptDefinition ( ',' encryptDefinition )*
+
+encryptDefinition ::=
+ tableName '(' 'COLUMNS' '(' columnDefinition ( ',' columnDefinition )* ')'
',' 'QUERY_WITH_CIPHER_COLUMN' '=' queryWithCipherColumn ')'
+
+columnDefinition ::=
+ 'NAME' '=' columnName ',' ( 'PLAIN' '=' plainColumnName )? 'CIPHER' '='
cipherColumnName ',' 'TYPE' '(' 'NAME' '=' encryptAlgorithmType ( ','
'PROPERTIES' '(' 'key' '=' 'value' ( ',' 'key' '=' 'value' )* ')' )? ')'
+
+tableName ::=
+ identifier
+
+queryWithCipherColumn ::=
+ identifier
+
+columnName ::=
+ identifier
+
+plainColumnName ::=
+ identifier
+
+cipherColumnName ::=
+ identifier
+
+encryptAlgorithmType ::=
+ identifier
+```
+
+### 补充说明
+
+- `PLAIN` 指定明文数据列,`CIPHER` 指定密文数据列;
+- `encryptAlgorithmType` 指定加密算法类型,请参考 加密算法;
+- 重复的 `tableName` 将无法被创建;
+- queryWithCipherColumn 支持大写或小写的 `true` 或 `false`。
+
+### 示例
+
+#### 创建数据加密规则
+
+```sql
+CREATE ENCRYPT RULE t_encrypt (
+COLUMNS(
+(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))),
+(NAME=order_id, CIPHER =order_cipher,TYPE(NAME='MD5'))
+),QUERY_WITH_CIPHER_COLUMN=true),
+t_encrypt_2 (
+COLUMNS(
+(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))),
+(NAME=order_id, CIPHER=order_cipher,TYPE(NAME='MD5'))
+), QUERY_WITH_CIPHER_COLUMN=FALSE);
+```
+
+### 保留字
+
+`CREATE`、`ENCRYPT`、`RULE`、`COLUMNS`、`NAME`、`CIPHER`、`PLAIN`、`QUERY_WITH_CIPHER_COLUMN`、`TYPE`、`TRUE`、`FALSE`
+
+### 相关链接
+
+- [保留字](/cn/reference/distsql/syntax/reserved-word/)
\ No newline at end of file
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/encrypt/create-encrypt-rule.en.md
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/encrypt/create-encrypt-rule.en.md
new file mode 100644
index 00000000000..7257364647a
--- /dev/null
+++
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/encrypt/create-encrypt-rule.en.md
@@ -0,0 +1,71 @@
++++
+title = "CREATE ENCRYPT RULE"
+weight = 2
++++
+
+## Description
+
+The `CREATE READWRITE_SPLITTING RULE` syntax is used to create a readwrite
splitting rule.
+
+### Syntax
+
+```sql
+CreateEncryptRule ::=
+ 'CREATE' 'ENCRYPT' 'RULE' encryptDefinition ( ',' encryptDefinition )*
+
+encryptDefinition ::=
+ tableName '(' 'COLUMNS' '(' columnDefinition ( ',' columnDefinition )* ')'
',' 'QUERY_WITH_CIPHER_COLUMN' '=' queryWithCipherColumn ')'
+
+columnDefinition ::=
+ 'NAME' '=' columnName ',' ( 'PLAIN' '=' plainColumnName )? 'CIPHER' '='
cipherColumnName ',' 'TYPE' '(' 'NAME' '=' encryptAlgorithmType ( ','
'PROPERTIES' '(' 'key' '=' 'value' ( ',' 'key' '=' 'value' )* ')' )? ')'
+
+tableName ::=
+ identifier
+
+queryWithCipherColumn ::=
+ identifier
+
+columnName ::=
+ identifier
+
+plainColumnName ::=
+ identifier
+
+cipherColumnName ::=
+ identifier
+
+encryptAlgorithmType ::=
+ identifier
+```
+
+### Supplement
+
+- `PLAIN` specifies the plain column, `CIPHER` specifies the cipher column
+- `encryptAlgorithmType` specifies the encryption algorithm type, please refer
to Encryption Algorithm
+- Duplicate `tableName` will not be created
+- `queryWithCipherColumn` support uppercase or lowercase true or false
+
+### Example
+
+#### Create a encrypt rule
+
+```sql
+CREATE ENCRYPT RULE t_encrypt (
+COLUMNS(
+(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))),
+(NAME=order_id, CIPHER =order_cipher,TYPE(NAME='MD5'))
+),QUERY_WITH_CIPHER_COLUMN=true),
+t_encrypt_2 (
+COLUMNS(
+(NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))),
+(NAME=order_id, CIPHER=order_cipher,TYPE(NAME='MD5'))
+), QUERY_WITH_CIPHER_COLUMN=FALSE);
+```
+
+### Reserved word
+
+`CREATE`, `ENCRYPT`, `RULE`, `COLUMNS`, `NAME`, `CIPHER`, `PLAIN`,
`QUERY_WITH_CIPHER_COLUMN`, `TYPE`, `TRUE`, `FALSE`
+
+### Related links
+
+- [Reserved word](/en/reference/distsql/syntax/reserved-word/)
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/readwrite-splitting/create-readwrite-splitting-rule.cn.md
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/readwrite-splitting/create-readwrite-splitting-rule.cn.md
index 35c77d312f0..eba796e967a 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/readwrite-splitting/create-readwrite-splitting-rule.cn.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/readwrite-splitting/create-readwrite-splitting-rule.cn.md
@@ -66,7 +66,7 @@ CREATE READWRITE_SPLITTING RULE ms_group_1 (
### 保留字
-`CREATE`、`READWRITE_SPLITTING`、`WRITE_RESOURCE`、`READ_RESOURCES`、`AUTO_AWARE_RESOURCE`、`WRITE_DATA_SOURCE_QUERY_ENABLED`
+`CREATE`、`READWRITE_SPLITTING`、`RULE`、`WRITE_RESOURCE`、`READ_RESOURCES`、`AUTO_AWARE_RESOURCE`、`WRITE_DATA_SOURCE_QUERY_ENABLED`
、`TYPE`、`NAME`、`PROPERTIES`、`TRUE`、`FALSE`
### 相关链接
diff --git
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/readwrite-splitting/create-readwrite-splitting-rule.en.md
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/readwrite-splitting/create-readwrite-splitting-rule.en.md
index c9768303978..b20fc4d6280 100644
---
a/docs/document/content/reference/distsql/syntax/rdl/rule-definition/readwrite-splitting/create-readwrite-splitting-rule.en.md
+++
b/docs/document/content/reference/distsql/syntax/rdl/rule-definition/readwrite-splitting/create-readwrite-splitting-rule.en.md
@@ -66,7 +66,7 @@ CREATE READWRITE_SPLITTING RULE ms_group_1 (
### Reserved word
-`CREATE`, `READWRITE_SPLITTING`, `WRITE_RESOURCE`, `READ_RESOURCES`,
`AUTO_AWARE_RESOURCE`
+`CREATE`, `READWRITE_SPLITTING`, `RULE`, `WRITE_RESOURCE`, `READ_RESOURCES`,
`AUTO_AWARE_RESOURCE`
, `WRITE_DATA_SOURCE_QUERY_ENABLED`, `TYPE`, `NAME`, `PROPERTIES`, `TRUE`,
`FALSE`
### Related links
diff --git a/docs/document/content/reference/distsql/syntax/reserved-word.cn.md
b/docs/document/content/reference/distsql/syntax/reserved-word.cn.md
index 03e7b8a86b4..f3efb845aa8 100644
--- a/docs/document/content/reference/distsql/syntax/reserved-word.cn.md
+++ b/docs/document/content/reference/distsql/syntax/reserved-word.cn.md
@@ -22,9 +22,13 @@ weight = 3
#### Readwrite Splitting
-`CREATE`、`READWRITE_SPLITTING`、`WRITE_RESOURCE`、`READ_RESOURCES`、`AUTO_AWARE_RESOURCE`、`WRITE_DATA_SOURCE_QUERY_ENABLED`
+`CREATE`、`READWRITE_SPLITTING`、`RULE`、`WRITE_RESOURCE`、`READ_RESOURCES`、`AUTO_AWARE_RESOURCE`、`WRITE_DATA_SOURCE_QUERY_ENABLED`
、`TYPE`、`NAME`、`PROPERTIES`、`TRUE`、`FALSE`
+#### Encrypt
+
+`CREATE`、`ENCRYPT`、`RULE`、`COLUMNS`、`NAME`、`CIPHER`、`PLAIN`、`QUERY_WITH_CIPHER_COLUMN`、`TYPE`、`TRUE`、`FALSE`
+
### 补充说明
- 上述保留字大小写不敏感
\ No newline at end of file
diff --git a/docs/document/content/reference/distsql/syntax/reserved-word.en.md
b/docs/document/content/reference/distsql/syntax/reserved-word.en.md
index 88edd374116..aede0f7e574 100644
--- a/docs/document/content/reference/distsql/syntax/reserved-word.en.md
+++ b/docs/document/content/reference/distsql/syntax/reserved-word.en.md
@@ -22,9 +22,13 @@ weight = 3
#### Readwrite Splitting
-`CREATE`, `READWRITE_SPLITTING`, `WRITE_RESOURCE`, `READ_RESOURCES`,
`AUTO_AWARE_RESOURCE`
+`CREATE`, `READWRITE_SPLITTING`, `RULE`, `WRITE_RESOURCE`, `READ_RESOURCES`,
`AUTO_AWARE_RESOURCE`
, `WRITE_DATA_SOURCE_QUERY_ENABLED`, `TYPE`, `NAME`, `PROPERTIES`, `TRUE`,
`FALSE`
+#### Encrypt
+
+`CREATE`, `ENCRYPT`, `RULE`, `COLUMNS`, `NAME`, `CIPHER`, `PLAIN`,
`QUERY_WITH_CIPHER_COLUMN`, `TYPE`, `TRUE`, `FALSE`
+
### Supplement
- The above reserved words are not case-sensitive
\ No newline at end of file