Documentation ¶
Index ¶
- Variables
- func Scrub(cloning interface{}, target interface{}, ...) string
- type DataType
- type FieldScrubOptioner
- type FieldScrubOpts
- func (f FieldScrubOpts) GetMaskingSymbol() string
- func (f FieldScrubOpts) PartMaskEnabled() bool
- func (f FieldScrubOpts) PartMaskMaxFldLen() int
- func (f FieldScrubOpts) PartMaskMinFldLen() int
- func (f FieldScrubOpts) PartMaskVisibleBackLen() int
- func (f FieldScrubOpts) PartMaskVisibleBackOnlyIfFldLenGreaterThan() int
- func (f FieldScrubOpts) PartMaskVisibleFrontLen() int
- type PartScrubConf
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultFieldScrubOpts = FieldScrubOpts{
MaskingSymbol: defaultMaskSymbol,
}
View Source
var ( // MaskLenVary specifies mask length equals DefaultMaskLen or mask length equals to value length MaskLenVary bool = false )
Functions ¶
func Scrub ¶
func Scrub(cloning interface{}, target interface{}, fieldsToScrub map[string]FieldScrubOptioner, dataType DataType) string
Scrub scrubs all the specified string fields in the 'target' struct at any level recursively and returns a DataType formatted string of the scrubbed struct.
A pointer to a new empty instance of the 'target' struct is needed to act as a 'cloning' of the 'target' to avoid race conditions
Types ¶
type FieldScrubOptioner ¶
type FieldScrubOptioner interface { GetMaskingSymbol() string PartMaskEnabled() bool PartMaskMinFldLen() int PartMaskMaxFldLen() int PartMaskVisibleFrontLen() int PartMaskVisibleBackOnlyIfFldLenGreaterThan() int PartMaskVisibleBackLen() int }
FieldScrubOptioner provides an interface for custom masking field options
type FieldScrubOpts ¶
type FieldScrubOpts struct { PartScrubConf MaskingSymbol string }
func (FieldScrubOpts) GetMaskingSymbol ¶
func (f FieldScrubOpts) GetMaskingSymbol() string
func (FieldScrubOpts) PartMaskEnabled ¶
func (f FieldScrubOpts) PartMaskEnabled() bool
func (FieldScrubOpts) PartMaskMaxFldLen ¶
func (f FieldScrubOpts) PartMaskMaxFldLen() int
func (FieldScrubOpts) PartMaskMinFldLen ¶
func (f FieldScrubOpts) PartMaskMinFldLen() int
func (FieldScrubOpts) PartMaskVisibleBackLen ¶
func (f FieldScrubOpts) PartMaskVisibleBackLen() int
func (FieldScrubOpts) PartMaskVisibleBackOnlyIfFldLenGreaterThan ¶
func (f FieldScrubOpts) PartMaskVisibleBackOnlyIfFldLenGreaterThan() int
func (FieldScrubOpts) PartMaskVisibleFrontLen ¶
func (f FieldScrubOpts) PartMaskVisibleFrontLen() int
type PartScrubConf ¶
type PartScrubConf struct { PartMaskEnabled bool PartMaskMinFldLen int PartMaskMaxFldLen int VisibleFrontLen int VisibleBackOnlyIfFldLenGreaterThan int VisibleBackLen int }
PartScrubConf provides options for partitial field masking
func NewPartScrubConf ¶
func NewPartScrubConf( partMaskEnabled bool, partMaskMinFldLen int, partMaskMaxFldLen int, visibleFrontLen int, visibleBackOnlyIfFldLenGreaterThan int, visibleBackLen int, ) *PartScrubConf
NewPartScrubConf is PartScrubConf constructor
Click to show internal directories.
Click to hide internal directories.