rules

package
v0.0.0-...-d6652e8 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CNPJRule = &Rule{
	Regex:     regexp.MustCompile(`\d{2}\.?\d{3}\.?\d{3}/?\d{4}-?\d{2}`),
	Method:    Hash,
	Prefix:    "CNPJ",
	Validator: brdoc.IsCNPJ,
}
View Source
var CPFRule = &Rule{
	Regex:     regexp.MustCompile(`\d{3}\.?\d{3}\.?\d{3}-?\d{2}`),
	Method:    Hash,
	Prefix:    "CPF",
	Validator: brdoc.IsCPF,
}
View Source
var Rules []*Rule

Functions

func Anonymize

func Anonymize(s string) string

Types

type Method

type Method string
const (
	Hash   Method = "Hash"
	Redact Method = "Redact"
)

type Rule

type Rule struct {
	Regex     *regexp.Regexp    `json:"regex"`
	Validator func(string) bool `json:"validator"`
	Method    Method            `json:"method"`
	Prefix    string            `json:"prefix"`
}

func (*Rule) Anonymize

func (r *Rule) Anonymize(s string) string

func (*Rule) Validate

func (r *Rule) Validate(s string) bool

Jump to

Keyboard shortcuts

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