ddm

package
v0.0.0-...-89dd5d7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 2 Imported by: 0

README

DDM

动态数据掩码(Dynamic Data Masking,简称为DDM)能够防止把敏感数据暴露给未经授权的用户。

类型 要求 示例 说明
手机号 前 3 后 4 132****7986 定长 11 位数字
邮箱地址 前 1 后 1 l**w@gmail.com 仅对 @ 之前的邮箱名称进行掩码
姓名 隐姓 *鸿章 将姓氏隐藏
密码 不输出 ******
银行卡卡号 前 6 后 4 622888******5676 银行卡卡号最多 19 位数字
身份证号 前 1 后 1 1******7 定长 18 位
代码示例
// 返回值
type message struct {
	Email     ddm.Email    `json:"email"`
}

msg := new(message)
msg.Email = ddm.Email("ChangSZ@163.com")
...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BankCard

type BankCard string

BankCard 银行卡号 622888******5676

func (BankCard) MarshalJSON

func (bc BankCard) MarshalJSON() ([]byte, error)

type Email

type Email string

Email 邮箱 l***w@gmail.com

func (Email) MarshalJSON

func (e Email) MarshalJSON() ([]byte, error)

type IDCard

type IDCard string

IDCard 身份证号 1******7

func (IDCard) MarshalJSON

func (card IDCard) MarshalJSON() ([]byte, error)

type IDName

type IDName string

IDName 姓名 *鸿章 TODO:参考 https://blog.thinkeridea.com/201910/go/efficient_string_truncation.html Deprecated:有更好的性能选择

func (IDName) MarshalJSON

func (name IDName) MarshalJSON() ([]byte, error)

type Mobile

type Mobile string

Mobile 手机号 132****7986

func (Mobile) MarshalJSON

func (m Mobile) MarshalJSON() ([]byte, error)

type PassWord

type PassWord string

PassWord 密码 ******

func (PassWord) MarshalJSON

func (pw PassWord) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL