数据过滤同时增加脱敏
This commit is contained in:
@ -10,6 +10,7 @@ package filter
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.zhangdeman.cn/zhangdeman/data_mask"
|
||||
"git.zhangdeman.cn/zhangdeman/data_mask/define"
|
||||
"github.com/tidwall/gjson"
|
||||
"github.com/tidwall/sjson"
|
||||
@ -113,8 +114,17 @@ func (t *Transform) rewrite(rule *define.FilterRule) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 数据脱敏
|
||||
realValue := sourceResult.String()
|
||||
if len(rule.DataMaskStrategy) > 0 {
|
||||
if realValue, err = data_mask.ExecuteWithError(realValue, rule.DataMaskStrategy); nil != err {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// TODO : 格式转换
|
||||
t.result, err = sjson.Set(t.result, rule.TargetDataPath, sourceResult.Value())
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
||||
// rewriteForSlice 数组重写
|
||||
|
Reference in New Issue
Block a user