go-masker icon indicating copy to clipboard operation
go-masker copied to clipboard

Support for generic masking methods

Open naeem-shaikh-tw opened this issue 2 years ago • 0 comments

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:

  1. If we can have some Generic types that can be used, such as mask:"all" and even more types such as mask:"first-3" or mask:"last-5"

  2. Or if we can add more specific types such as mask:"ssn" or mask:"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?

naeem-shaikh-tw avatar Oct 22 '21 10:10 naeem-shaikh-tw