Documentation
¶
Index ¶
- Variables
- type CsvValidator
- type EditorConfigValidator
- type EnvValidator
- type FormatValidator
- type HclValidator
- type HoconValidator
- type IniValidator
- type JSONValidator
- type PlistValidator
- type PropValidator
- type SyntaxValidator
- type TomlValidator
- type ToonValidator
- type Validator
- type XMLValidator
- type YAMLValidator
Constants ¶
This section is empty.
Variables ¶
var ErrMethodUnimplemented = errors.New("method unimplemented")
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) ValidateFormat ¶ added in v1.10.0
func (CsvValidator) ValidateFormat(_ []byte, _ any) (bool, error)
func (CsvValidator) ValidateSyntax ¶ added in v1.10.0
func (CsvValidator) ValidateSyntax(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) ValidateFormat ¶ added in v1.10.0
func (EditorConfigValidator) ValidateFormat(_ []byte, _ any) (bool, error)
func (EditorConfigValidator) ValidateSyntax ¶ added in v1.10.0
func (EditorConfigValidator) ValidateSyntax(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) ValidateFormat ¶ added in v1.10.0
func (EnvValidator) ValidateFormat(_ []byte, _ any) (bool, error)
func (EnvValidator) ValidateSyntax ¶ added in v1.10.0
func (EnvValidator) ValidateSyntax(b []byte) (bool, error)
Validate implements the Validator interface by attempting to parse a byte array of a env file using envparse package
type FormatValidator ¶ added in v1.10.0
FormatValidator is the interface that wraps the ValidateFormat method It accepts a byte array of a file or string to be validated for format and returns true or false if the content of the byte array is valid in the specified format or not. If it is not valid, the error return value will be populated.
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) ValidateFormat ¶ added in v1.10.0
func (HclValidator) ValidateFormat(_ []byte, _ any) (bool, error)
func (HclValidator) ValidateSyntax ¶ added in v1.10.0
func (HclValidator) ValidateSyntax(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) ValidateFormat ¶ added in v1.10.0
func (HoconValidator) ValidateFormat(_ []byte, _ any) (bool, error)
func (HoconValidator) ValidateSyntax ¶ added in v1.10.0
func (HoconValidator) ValidateSyntax(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) ValidateFormat ¶ added in v1.10.0
func (IniValidator) ValidateFormat(_ []byte, _ any) (bool, error)
func (IniValidator) ValidateSyntax ¶ added in v1.10.0
func (IniValidator) ValidateSyntax(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) ValidateFormat ¶ added in v1.10.0
func (JSONValidator) ValidateFormat(b []byte, _ any) (bool, error)
func (JSONValidator) ValidateSyntax ¶ added in v1.10.0
func (JSONValidator) ValidateSyntax(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) ValidateFormat ¶ added in v1.10.0
func (PlistValidator) ValidateFormat(_ []byte, _ any) (bool, error)
func (PlistValidator) ValidateSyntax ¶ added in v1.10.0
func (PlistValidator) ValidateSyntax(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) ValidateFormat ¶ added in v1.10.0
func (PropValidator) ValidateFormat(_ []byte, _ any) (bool, error)
func (PropValidator) ValidateSyntax ¶ added in v1.10.0
func (PropValidator) ValidateSyntax(b []byte) (bool, error)
Validate implements the Validator interface by attempting to parse a byte array of properties
type SyntaxValidator ¶ added in v1.10.0
SyntaxValidator is the interface that wraps the ValidateSyntax method It accepts a byte array of a file or string to be validated for syntax and returns true or false if the content of the byte array is syntactically valid or not. If it is not valid, the error return value will be populated.
type TomlValidator ¶ added in v1.1.0
type TomlValidator struct{}
func (TomlValidator) ValidateFormat ¶ added in v1.10.0
func (TomlValidator) ValidateFormat(_ []byte, _ any) (bool, error)
func (TomlValidator) ValidateSyntax ¶ added in v1.10.0
func (TomlValidator) ValidateSyntax(b []byte) (bool, error)
type ToonValidator ¶ added in v1.9.0
type ToonValidator struct{}
func (ToonValidator) ValidateFormat ¶ added in v1.10.0
func (ToonValidator) ValidateFormat(_ []byte, _ any) (bool, error)
func (ToonValidator) ValidateSyntax ¶ added in v1.10.0
func (ToonValidator) ValidateSyntax(b []byte) (bool, error)
ValidateSyntax implements the Validator interface by attempting to unmarshall a byte array of toon
type Validator ¶
type Validator interface {
SyntaxValidator
FormatValidator
}
type XMLValidator ¶ added in v1.7.0
type XMLValidator struct{}
func (XMLValidator) ValidateFormat ¶ added in v1.10.0
func (XMLValidator) ValidateFormat(_ []byte, _ any) (bool, error)
func (XMLValidator) ValidateSyntax ¶ added in v1.10.0
func (XMLValidator) ValidateSyntax(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) ValidateFormat ¶ added in v1.10.0
func (YAMLValidator) ValidateFormat(_ []byte, _ any) (bool, error)
func (YAMLValidator) ValidateSyntax ¶ added in v1.10.0
func (YAMLValidator) ValidateSyntax(b []byte) (bool, error)
Validate implements the Validator interface by attempting to unmarshall a byte array of yaml