minimizers

package module
v0.0.0-...-26c6ba7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LevelStringMap = map[MinimizationLevel]string{
	MinimizationNone:      "none",
	MinimizationCoarse:    "coarse",
	MinimizationFine:      "fine",
	MinimizationAnonymize: "anonymize",
	MinimizationTokenize:  "tokenize",
	MinimizationMask:      "mask",
}
View Source
var StringLevelMap = map[string]MinimizationLevel{
	"none":      MinimizationNone,
	"coarse":    MinimizationCoarse,
	"fine":      MinimizationFine,
	"anonymize": MinimizationAnonymize,
	"tokenize":  MinimizationTokenize,
	"mask":      MinimizationMask,
}
View Source
var TagMap = map[string]Minimizer{
	"name":  MinimizeName,
	"email": MinimizeEmail,
}

Functions

func AddCustomMinimizer

func AddCustomMinimizer(m Minimizer, tag string) error

func DeleteCustomMinimizer

func DeleteCustomMinimizer(tag string)

func EnableDebugLogging

func EnableDebugLogging()

func Mask

func Mask(input string) (string, error)

Mask randomly swaps out alphanumeric values within a string with type-matching random values. The format (and case) of the string is preserved, while special characters are left in-place. e.g. Mask("123-456-7890") => "155-503-1463"

func MaskWithPattern

func MaskWithPattern(input string, pattern rune) (string, error)

MaskWithPattern provides a masking variant in which all alphanumeric characters are replaced with a given pattern. e.g. MaskWithPattern("123-456-7890", 'X') => "XXX-XXX-XXXX".

func MinimizeEmail

func MinimizeEmail(level MinimizationLevel, email interface{}) interface{}

func MinimizeName

func MinimizeName(level MinimizationLevel, name interface{}) interface{}

MinimizeName provides name minimization. Coarse-grained minimization returns first initial and last name, while fine-grained minimization returns only the first name. Anonymization will return a randomly generated name.

func MinimizeStruct

func MinimizeStruct(l MinimizationLevel, s interface{}) error

func Tokenize

func Tokenize() (string, error)

Tokenize produces a random token for a given string-based data field, prefixed with 'tok_'.

Types

type Errors

type Errors []error

func (Errors) Error

func (e Errors) Error() string

func (Errors) Errors

func (e Errors) Errors() []error

type MinimizationLevel

type MinimizationLevel int
const (
	// No data minimization
	MinimizationNone MinimizationLevel = iota

	// Coarse-grained data minimization
	MinimizationCoarse

	// Fine-grained data minimization
	MinimizationFine

	// Data anonymization
	MinimizationAnonymize

	// Data tokenization
	MinimizationTokenize

	// Data masking
	MinimizationMask
)

func LevelFromString

func LevelFromString(levelString string) MinimizationLevel

func (MinimizationLevel) MarshalJSON

func (l MinimizationLevel) MarshalJSON() ([]byte, error)

func (MinimizationLevel) String

func (l MinimizationLevel) String() string

func (*MinimizationLevel) UnmarshalJSON

func (l *MinimizationLevel) UnmarshalJSON(b []byte) error

type Minimizer

type Minimizer func(level MinimizationLevel, data interface{}) interface{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL