Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do i get an unmasked value from the struct? #12

Open
roborobs1023 opened this issue Aug 18, 2020 · 1 comment
Open

How do i get an unmasked value from the struct? #12

roborobs1023 opened this issue Aug 18, 2020 · 1 comment

Comments

@roborobs1023
Copy link

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?

@yusufsyaifudin
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants