Documentation ¶
Overview ¶
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-08-03 22:19:05 * @FilePath: \go-toolbox\pkg\desensitize\constants.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-01 22:23:03 * @FilePath: \go-toolbox\pkg\desensitize\model.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
Index ¶
- func Desensitize(str string, DesensitizeType DesensitizeType, options ...DesensitizeOptions) string
- func SensitiveData(str string, start, end int) string
- func SensitizeBankCard(str string, cardLength int) string
- func SensitizeCarLicense(str string) string
- func SensitizeIpv4(str string) string
- func SensitizeIpv6(str string) string
- func SensitizePhoneNumber(str string, start, end int) string
- type DesensitizeOptions
- type DesensitizeType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Desensitize ¶
func Desensitize(str string, DesensitizeType DesensitizeType, options ...DesensitizeOptions) string
Desensitize 数据脱敏
Types ¶
type DesensitizeOptions ¶
type DesensitizeOptions struct { CustomExtensionStartIndex int CustomExtensionEndIndex int ChineseNameStartIndex int ChineseNameEndIndex int IdCardStartIndex int IdCardEndIndex int IdCardLength int PhoneNumberStartIndex int PhoneNumberEndIndex int MobilePhoneStartIndex int EmailStartIndex int AddressLength int }
DesensitizeOptions 脱敏选项
func NewDesensitizeOptions ¶
func NewDesensitizeOptions() DesensitizeOptions
NewDesensitizeOptions 创建带有默认值的 DesensitizeOptions
type DesensitizeType ¶
type DesensitizeType int
const ( CustomExtension DesensitizeType = iota + 1 // 自定义扩展 ChineseName // 中文名称 IDCard // 身份证号 PhoneNumber // 手机号码 MobilePhone // 移动电话号码 Address // 地址 Email // 邮箱 Password // 密码 CarLicense // 车牌号:油车、电车 BankCard // 银行卡号 IPV4 // ipv4 IPV6 // ipv6 )
Click to show internal directories.
Click to hide internal directories.