package
0.0.0-20250203051558-d4ce131ff7ec
Repository: https://github.com/jasacloud/go-libraries.git
Documentation: pkg.go.dev

# Functions

Address keep first 6 letters, mask the rest Example: input: 台北市內湖區內湖路一段737巷1號1樓 output: 台北市內湖區******.
CreditCard mask 6 digits from the 7'th digit Example: input1: 1234567890123456 (VISA, JCB, MasterCard)(len = 16) output1: 123456******3456 input2: 123456789012345 (American Express)(len = 15) output2: 123456******345.
Email keep domain and the first 3 letters Example: input: [email protected] output: ggw****@gmail.com.
ID mask last 4 digits of ID number Example: input: A123456789 output: A12345****.
Mobile mask 3 digits from the 4'th digit Example: input: 0987654321 output: 0987***321.
Name mask the second letter and the third letter Example: input: ABCD output: A**D.
New create Masker.
Password always return "************".
String mask input string of the mask type Example: masker.String(masker.MName, "ggwhite") masker.String(masker.MID, "A123456789") masker.String(masker.MMobile, "0987987987").
Struct must input a interface{}, add tag mask on struct fields, after Struct(), return a pointer interface{} of input type and it will be masked with the tag format type Example: type Foo struct { Name string `mask:"name"` Email string `mask:"email"` Password string `mask:"password"` ID string `mask:"id"` Address string `mask:"addr"` Mobile string `mask:"mobile"` Telephone string `mask:"tel"` Credit string `mask:"credit"` Foo *Foo `mask:"struct"` } func main() { s := &Foo{ Name: ..., Email: ..., Password: ..., Foo: &{ Name: ..., Email: ..., Password: ..., } } t, err := masker.Struct(s) fmt.Println(t.(*Foo)) }.
Telephone remove "(", ")", " ", "-" chart, and mask last 4 digits of telephone number, format to "(??)????-????" Example: input: 0227993078 output: (02)2799-****.
No description provided by the author

# Constants

Maske Types of format string.
Maske Types of format string.
Maske Types of format string.
Maske Types of format string.
Maske Types of format string.
Maske Types of format string.
Maske Types of format string.
Maske Types of format string.
Maske Types of format string.

# Structs

Masker is a instance to marshal masked string.