config

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(c Config) error

Validate deeply validates the config based on the tags

Types

type Config

type Config struct {
	Version      string
	APIKey       string
	Variables    variables.Variables
	Transactions []transaction.Transaction
}

Config holds the internal representation of the config

func Load

func Load(path string) (Config, error)

type DefaultValidator

type DefaultValidator struct {
}

DefaultValidator does not perform any validations.

func (DefaultValidator) Validate

func (v DefaultValidator) Validate(val interface{}) (bool, error)

Validate method performs validation and returns result and optional error.

type ExpectBodyValidator

type ExpectBodyValidator struct{}

ExpectBodyValidator validates a step.ExpectBody so that the type and the exact fields make sense together. It also sets the defaults for type and exact

func (ExpectBodyValidator) Validate

func (v ExpectBodyValidator) Validate(val interface{}) (b bool, err error)

type RequiredValidator

type RequiredValidator struct{}

RequiredValidator validates slices and their length

func (RequiredValidator) Validate

func (v RequiredValidator) Validate(val interface{}) (b bool, err error)

Validate method performs validation and returns result and optional error.

type UniqueValidator

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

UniqueValidator validates all elements in the slice have unique property (defined by the prop)

func (UniqueValidator) Validate

func (v UniqueValidator) Validate(val interface{}) (b bool, err error)

Validate method performs validation and returns result and optional error.

type Validator

type Validator interface {
	// Validate method performs validation and returns result and optional error.
	Validate(interface{}) (bool, error)
}

Validator iterface for the different types to implement

type VersionValidator

type VersionValidator struct{}

VersionValidator validates string if it is a valid version

func (VersionValidator) Validate

func (v VersionValidator) Validate(val interface{}) (bool, error)

Validate method performs validation and returns result and optional error.

Jump to

Keyboard shortcuts

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