数据脱敏
存储单元操作
REGISTER STORAGE UNIT ds_0 (
HOST="127.0.0.1",
PORT=3306,
DB="ds_0",
USER="root",
PASSWORD="root"
);
规则操作
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 TABLE `t_mask` (
`id` int(11) NOT NULL,
`user_id` varchar(45) DEFAULT NULL,
`phone_number` varchar(45) DEFAULT NULL,
`address` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
ALTER MASK RULE t_mask (
COLUMNS(
(NAME=user_id,TYPE(NAME='MD5'))
));
UNREGISTER STORAGE UNIT ds_0;