Documentation ¶
Index ¶
- Constants
- func CreateMasking(db *gorm.DB)
- func QueryMasking(db *gorm.DB)
- func RegisterTypeOptions(maskingType MaskingType, dFunc DataMasking)
- func UpdateMasking(db *gorm.DB)
- type CommonMasking
- type Config
- type DataMasking
- type DataStore
- type Masking
- type MaskingPosition
- type MaskingType
- type NonVisitLog
- type SameTableDataStore
- type VisitLog
- type VisitType
Constants ¶
View Source
const ( // struct tag name MaskingTag = "masking" // struct tag name MaskingEncryptColumnTag = "masking_encrypt_column" // context key,value is []string UnMaskingContext = "unmasking" )
system const value
Variables ¶
This section is empty.
Functions ¶
func CreateMasking ¶
func QueryMasking ¶
func RegisterTypeOptions ¶
func RegisterTypeOptions(maskingType MaskingType, dFunc DataMasking)
func UpdateMasking ¶
Types ¶
type CommonMasking ¶
type CommonMasking struct {
// contains filtered or unexported fields
}
func NewCommonMasking ¶
func NewCommonMasking(secretKey string, maskingRate float32, maskingPosition MaskingPosition) *CommonMasking
type DataMasking ¶
type DataMasking interface { // // Making // @Description: desensitization and encryption data // @param src // @param field // @param db // @return string desensitization value // @return string encryption value // Making(src string, field *schema.Field, db *gorm.DB) (string, string) // // UnMasking // @Description: unmasking data // @param v encryption value // @param field // @param db // @return string unmasking value // UnMasking(v string, field *schema.Field, db *gorm.DB) string }
func GetTypeOption ¶
func GetTypeOption(maskingType MaskingType) DataMasking
type DataStore ¶
type DataStore interface { Create(field *schema.Field, v reflect.Value, desensitizationValue, encryptionValue string, actualValue interface{}, desensitizationType MaskingType, db *gorm.DB) error Update(field *schema.Field, desensitizationValue, encryptionValue string, actualValue interface{}, desensitizationType MaskingType, db *gorm.DB) error }
数据存储的实现 每个表单独实现,其中有内部实现
type MaskingPosition ¶
type MaskingPosition string
const ( Left MaskingPosition = "left" Right MaskingPosition = "right" Middle MaskingPosition = "middle" )
type MaskingType ¶
type MaskingType string
base data type
const (
Common MaskingType = "common"
)
plugin has implemented plugin type
type SameTableDataStore ¶
type SameTableDataStore struct { }
SameTableDataStore
@Description: save the desensitization value and encryption value in the same table
func (*SameTableDataStore) Create ¶
func (o *SameTableDataStore) Create(field *schema.Field, vv reflect.Value, desensitizationValue, encryptionValue string, actualValue interface{}, desensitizationType MaskingType, db *gorm.DB) error
func (*SameTableDataStore) Update ¶
func (o *SameTableDataStore) Update(field *schema.Field, desensitizationValue, encryptionValue string, actualValue interface{}, desensitizationType MaskingType, db *gorm.DB) error
Click to show internal directories.
Click to hide internal directories.