CREATE MASK RULE
Description
The CREATE MASK RULE
syntax is used to create a mask rule.
Syntax
Grammar Railroad diagram
CreateEncryptRule ::=
'CREATE' 'MASK' 'RULE' ifNotExists? maskRuleDefinition (',' maskRuleDefinition)*
ifNotExists ::=
'IF' 'NOT' 'EXISTS'
maskRuleDefinition ::=
ruleName '(' 'COLUMNS' '(' columnDefinition (',' columnDefinition)* ')' ')'
columnDefinition ::=
'(' 'NAME' '=' columnName ',' maskAlgorithmDefinition ')'
maskAlgorithmDefinition ::=
'TYPE' '(' 'NAME' '=' algorithmType (',' propertiesDefinition)? ')'
propertiesDefinition ::=
'PROPERTIES' '(' key '=' value (',' key '=' value)* ')'
ruleName ::=
identifier
columnName ::=
identifier
algorithmType ::=
literal
key ::=
string
value ::=
literal
Note
algorithmType
specifies the data masking algorithm type. For more details, please refer to Data Masking Algorithm;- Duplicate
ruleName
will not be created; ifNotExists
clause is used for avoidDuplicate mask rule
error.
Example
Create a mask rule
CREATE MASK RULE t_mask (
COLUMNS(
(NAME=phone_number,TYPE(NAME='MASK_FROM_X_TO_Y', PROPERTIES("from-x"=1, "to-y"=2, "replace-char"="*"))),
(NAME=address,TYPE(NAME='MD5'))
));
Create mask rule with ifNotExists
clause
CREATE MASK RULE IF NOT EXISTS t_mask (
COLUMNS(
(NAME=phone_number,TYPE(NAME='MASK_FROM_X_TO_Y', PROPERTIES("from-x"=1, "to-y"=2, "replace-char"="*"))),
(NAME=address,TYPE(NAME='MD5'))
));
Reserved words
CREATE
, MASK
, RULE
, COLUMNS
, NAME
, TYPE
Related links
当前内容版权归 ShardingSphere 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 ShardingSphere .