internal

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NewLine     string = "\n"
	NewLineByte byte   = '\n'
	Empty       string = ""
)

Pre-defined control characters

View Source
const AnnotationDelimiters string = "{} "

Variables

View Source
var (
	RegexSeparator *regexp.Regexp = regexp.MustCompile(`^[=|:;,.?@]{1}$`)
	RegexComments  *regexp.Regexp = regexp.MustCompile(`^[#|:;,.?@]{1}$`)
)

Regex for separator and comment validation

View Source
var RegexAnnotation *regexp.Regexp = regexp.MustCompile(`{{\s*(\w+)\s*}}`)

Functions

func CheckDuplication

func CheckDuplication(source []string, separator string) (bool, string)

CheckDuplication check for any duplicated names in source

func Extract

func Extract(line string, name string, separator string) (string, bool)

Extract search for a name in line and return value and true if found, else return empty string and false if not found

func Normalization

func Normalization(source string, separator string, comment string) ([]string, error)

Normalization parse each line and return prepared source collection

func NormalizeLine

func NormalizeLine(line string, separator string, comment string) (string, error)

NormalizeLine parse line and return prepared line

func Parse

func Parse(line string, separator string, comment string) (string, string, error)

Parse parse the line of words and return "key", "value" if has not error

func Treasure added in v1.0.2

func Treasure(source []string, separator string) (map[string]string, error)

Treasure prepare source as a collection

func ValidationDelimiters

func ValidationDelimiters(separator string, comment string) error

ValidationDelimiters validate demilimters such as separator and comment

func ValidationFile added in v1.1.1

func ValidationFile(file *os.File) error

ValidationFile check file stat and size

func ValidationName

func ValidationName(name string) (string, bool)

ValidationName check name validation and return trimed name, return false if name is invalid

func ValidationSource

func ValidationSource(source string) error

ValidationSource validate source string

func ValidationSuffix added in v1.1.0

func ValidationSuffix(suffix string) (string, bool)

ValidationSuffix check suffix validation and return right trimed suffix, return flase if suffix is invalid

Types

This section is empty.

Jump to

Keyboard shortcuts

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