validator

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 17 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 (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 EditorConfigValidator added in v1.7.0

type EditorConfigValidator struct{}

func (EditorConfigValidator) Validate added in v1.7.0

func (EditorConfigValidator) Validate(b []byte) (bool, error)

Validate implements the Validator interface by attempting to parse a byte array of an editorconfig file using editorconfig-core-go package

type EnvValidator added in v1.6.0

type EnvValidator struct{}

func (EnvValidator) Validate added in v1.6.0

func (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 (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 (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 (IniValidator) Validate(b []byte) (bool, error)

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

type JSONValidator added in v1.7.0

type JSONValidator struct{}

func (JSONValidator) Validate added in v1.7.0

func (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 (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 (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 (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 added in v1.7.0

type XMLValidator struct{}

func (XMLValidator) Validate added in v1.7.0

func (XMLValidator) Validate(b []byte) (bool, error)

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

type YAMLValidator added in v1.7.0

type YAMLValidator struct{}

func (YAMLValidator) Validate added in v1.7.0

func (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