go-masker
go-masker copied to clipboard
How do i get an unmasked value from the struct?
say for instance I have
package main
import ( masker "github.com/ggwhite/go-masker" )
func main() { masker.String(masker.MName, "ggwhite") masker.String(masker.MID, "A123456789") masker.String(masker.MMobile, "0987987987") }
how would I be able to unmask the strings for use in sql query statement?
@roborobs1023 I think it is not the responsibility of this package to unmask the value after masked. Why? Because when you want to mask value, you actually already know the exact value or unmasked value before you mask it. Hence, if you want to get an unmasked value, just use an old variable. For example:
var name = "customer name"
var maskedName = masker.String(masker.MName, name)
fmt.Println(name) // print "customer name"
fmt.Println(maskedName) // print masked customer name