validator

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CsvValidator added in v1.5.0

type CsvValidator struct{}

CsvValidator is used to validate a byte slice that is intended to represent a CSV file.

func (CsvValidator) Validate added in v1.5.0

func (csvv CsvValidator) Validate(b []byte) (bool, error)

Validate checks if the provided byte slice represents a valid .csv file. https://pkg.go.dev/encoding/csv

type EnvValidator added in v1.6.0

type EnvValidator struct{}

func (EnvValidator) Validate added in v1.6.0

func (envv EnvValidator) Validate(b []byte) (bool, error)

Validate implements the Validator interface by attempting to parse a byte array of a env file using envparse package

type HclValidator added in v1.5.0

type HclValidator struct{}

HclValidator is used to validate a byte slice that is intended to represent a HashiCorp Configuration Language (HCL) file.

func (HclValidator) Validate added in v1.5.0

func (hclv HclValidator) Validate(b []byte) (bool, error)

Validate checks if the provided byte slice represents a valid .hcl file.

The hcl parser uses FIFO to determine which error to display to the user. For more information, see the documentation at:

https://pkg.go.dev/github.com/hashicorp/hcl/v2#Diagnostics.Error

If the hcl.Diagnostics slice contains more than one error, the wrapped error returned by this function will include them as "and {count} other diagnostic(s)" in the error message.

type HoconValidator added in v1.6.0

type HoconValidator struct{}

HoconValidator is used to validate a byte slice that is intended to represent a HOCON file.

func (HoconValidator) Validate added in v1.6.0

func (hv HoconValidator) Validate(b []byte) (bool, error)

Validate checks if the provided byte slice represents a valid .hocon file.

type IniValidator added in v1.3.0

type IniValidator struct{}

func (IniValidator) Validate added in v1.3.0

func (iv IniValidator) Validate(b []byte) (bool, error)

Validate implements the Validator interface by attempting to parse a byte array of ini

type JsonValidator

type JsonValidator struct{}

func (JsonValidator) Validate

func (jv JsonValidator) Validate(b []byte) (bool, error)

Validate implements the Validator interface by attempting to unmarshall a byte array of json

type PlistValidator added in v1.5.0

type PlistValidator struct{}

PlistValidator is used to validate a byte slice that is intended to represent a Apple Property List file (plist).

func (PlistValidator) Validate added in v1.5.0

func (csvv PlistValidator) Validate(b []byte) (bool, error)

Validate checks if the provided byte slice represents a valid .plist file.

type PropValidator added in v1.5.0

type PropValidator struct{}

func (PropValidator) Validate added in v1.5.0

func (pv PropValidator) Validate(b []byte) (bool, error)

Validate implements the Validator interface by attempting to parse a byte array of properties

type TomlValidator added in v1.1.0

type TomlValidator struct{}

func (TomlValidator) Validate added in v1.1.0

func (tv TomlValidator) Validate(b []byte) (bool, error)

type Validator

type Validator interface {
	Validate(b []byte) (bool, error)
}

Validate accepts a byte array of a file or string to be validated and returns true or false if the content of the byte array is valid or not. If it is not valid, the error return value will be populated.

type XmlValidator

type XmlValidator struct{}

func (XmlValidator) Validate

func (xv XmlValidator) Validate(b []byte) (bool, error)

Validate implements the Validator interface by attempting to unmarshall a byte array of xml

type YamlValidator

type YamlValidator struct{}

func (YamlValidator) Validate

func (yv YamlValidator) Validate(b []byte) (bool, error)

Validate implements the Validator interface by attempting to unmarshall a byte array of yaml

Jump to

Keyboard shortcuts

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