validator

package
v5.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

README

validator

-- import "gopkg.in/Clever/kayvee-go.v5/validator"

Usage

func ValidateJSONFormat
func ValidateJSONFormat(logLine string) error

ValidateJSONFormat returns a errors if the given string is not a valid JSON-formatted kayvee log line.

type InvalidJSONError
type InvalidJSONError struct {
}

InvalidJSONError is returned by ValidateJSONFormat for log lines that aren't valid JSON objects.

func (*InvalidJSONError) Error
func (e *InvalidJSONError) Error() string
type InvalidValueError
type InvalidValueError struct {
	Field string
	Value interface{}
}

InvalidValueError is returned for log lines containing a field with an invalid value.

func (*InvalidValueError) Error
func (e *InvalidValueError) Error() string
type InvalidValueTypeError
type InvalidValueTypeError struct {
	Field        string
	ExpectedType ValueType
}

InvalidValueTypeError is returned for log lines containing a field with an invalid value type.

func (*InvalidValueTypeError) Error
func (e *InvalidValueTypeError) Error() string
type MissingRequiredFieldError
type MissingRequiredFieldError struct {
	Field string
}

MissingRequiredFieldError is returned for log lines that don't contain a required field. NOTE: Certain fields are only required for specific log types.

func (*MissingRequiredFieldError) Error
func (e *MissingRequiredFieldError) Error() string
type ValueType
type ValueType string

ValueType represents the valuve type of a Kayvee field, where applicable.

const (
	StringType ValueType = "string"
	NumberType ValueType = "number"
)

Kayvee value types that are explicitly checked.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateJSONFormat

func ValidateJSONFormat(logLine string) error

ValidateJSONFormat returns a errors if the given string is not a valid JSON-formatted kayvee log line.

Types

type InvalidJSONError

type InvalidJSONError struct {
	// contains filtered or unexported fields
}

InvalidJSONError is returned by `ValidateJSONFormat` for log lines that aren't valid JSON objects.

func (*InvalidJSONError) Error

func (e *InvalidJSONError) Error() string

type InvalidValueError

type InvalidValueError struct {
	Field string
	Value interface{}
}

InvalidValueError is returned for log lines containing a field with an invalid value.

func (*InvalidValueError) Error

func (e *InvalidValueError) Error() string

type InvalidValueTypeError

type InvalidValueTypeError struct {
	Field        string
	ExpectedType ValueType
}

InvalidValueTypeError is returned for log lines containing a field with an invalid value type.

func (*InvalidValueTypeError) Error

func (e *InvalidValueTypeError) Error() string

type MissingRequiredFieldError

type MissingRequiredFieldError struct {
	Field string
}

MissingRequiredFieldError is returned for log lines that don't contain a required field. NOTE: Certain fields are only required for specific log types.

func (*MissingRequiredFieldError) Error

func (e *MissingRequiredFieldError) Error() string

type ValueType

type ValueType string

ValueType represents the valuve type of a Kayvee field, where applicable.

const (
	StringType ValueType = "string"
	NumberType ValueType = "number"
)

Kayvee value types that are explicitly checked.

Jump to

Keyboard shortcuts

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