Documentation ¶
Index ¶
Constants ¶
View Source
const ( // JSONTag is the default JSON struct tag to use. JSONTag = "json" // SecureOption is the tag option to enable sparse encryption of a struct field. SecureOption = "secure" // HashOption is the tag option to hash a struct field of type string. Defaults to SHA256. HashOption = "hash" )
Variables ¶
This section is empty.
Functions ¶
func HasOption ¶
HasOption checks to see if the tag options contain a specific option.
func IgnoreField ¶
IgnoreField checks the name to see if field should be ignored.
func IsSecure ¶
IsSecure checks to see if the secure option is set.
Types ¶
type Hash ¶
type Hash string
Hash provides a type for supported hash function names
const ( // HashNone is used to indicate no has function was found in the tag options. HashNone Hash = "" // HashSHA256 sets the HashOption to use sha256. This is the default. // TODO: support parsing this from the struct field tag hash option e.g. `...,hash=md5"` HashSHA256 = "sha256" )
func HashName ¶
HashName checks to see if the hash option is set. The struct field *MUST BE* type string and capable of holding the decoded hash as a string. If no hash option is found it will return HashNone. Defaults to HashSHA256 (sha256).
Click to show internal directories.
Click to hide internal directories.