normalizer

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Formats - Valid formats
	Formats = map[string]Format{
		// contains filtered or unexported fields
	}
)

Functions

func SupportedFormats

func SupportedFormats() []string

SupportedFormats - List of supported formats

Types

type ColonNewline

type ColonNewline struct{}

ColonNewline - The colon/newline delimited format

func (ColonNewline) GetName

func (cn ColonNewline) GetName() string

GetName - Return the format's name

func (ColonNewline) GetPattern

func (cn ColonNewline) GetPattern() *regexp.Regexp

GetPattern - Return the format's name

func (ColonNewline) Normalize

func (cn ColonNewline) Normalize(line string) (string, string, string, string, error)

Normalize - Normalize a line, return email, user, domain, password, error

type Entry

type Entry struct {
	Email    string `json:"email"`
	User     string `json:"user"`
	Domain   string `json:"domain"`
	Password string `json:"password"`
}

Entry - A single entry

type Format

type Format interface {
	GetName() string
	GetPattern() *regexp.Regexp
	Normalize(line string) (string, string, string, string, error)
}

Format - Pair of line pattern and normalizer func

type Normalize

type Normalize struct {
	Format     Format
	Targets    []string
	Output     *os.File
	Recursive  bool
	SkipPrefix string
	SkipSuffix string

	Errors []error
	// contains filtered or unexported fields
}

Normalize - Normalizer job

func GetNormalizer

func GetNormalizer(format Format, target string, output string, recursive bool, skipPrefix, skipSuffix string) (*Normalize, error)

GetNormalizer - Start the normalizer

func (*Normalize) GetStatus

func (n *Normalize) GetStatus() (string, int)

GetStatus - Return the current target file and line number

func (*Normalize) Start

func (n *Normalize) Start()

Start - Start the normalization process

type SemicolonNewline

type SemicolonNewline struct{}

SemicolonNewline - The colon/newline delimited format

func (SemicolonNewline) GetName

func (cn SemicolonNewline) GetName() string

GetName - Return the format's name

func (SemicolonNewline) GetPattern

func (cn SemicolonNewline) GetPattern() *regexp.Regexp

GetPattern - Return the format's name

func (SemicolonNewline) Normalize

func (cn SemicolonNewline) Normalize(line string) (string, string, string, string, error)

Normalize - Normalize a line, return email, user, domain, password, error

type WhitespaceNewline

type WhitespaceNewline struct{}

WhitespaceNewline - The colon/newline delimited format

func (WhitespaceNewline) GetName

func (cn WhitespaceNewline) GetName() string

GetName - Return the format's name

func (WhitespaceNewline) GetPattern

func (cn WhitespaceNewline) GetPattern() *regexp.Regexp

GetPattern - Return the format's name

func (WhitespaceNewline) Normalize

func (cn WhitespaceNewline) Normalize(line string) (string, string, string, string, error)

Normalize - Normalize a line, return email, user, domain, password, error

Jump to

Keyboard shortcuts

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