go-masker
go-masker copied to clipboard
Support for generic masking methods
Hello, I want to mask all the characters in a field in my struct that is not a password. https://play.golang.org/p/xAdDleuk1KN
type personalDetails struct {
SSN string `mask:"password"`
}
While this works fine, but masking it as a type password does not make sense to the reader. It sounds more like SSN is a password when I read the code.
I was wondering if we can solve this by any of the two approaches:
-
If we can have some Generic types that can be used, such as
mask:"all"
and even more types such asmask:"first-3"
ormask:"last-5"
-
Or if we can add more specific types such as
mask:"ssn"
ormask:"dob"
Having more specialised types just makes is rigid to use, so if we can add some generic types like mentioned in approach 1 above?