Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FieldData

type FieldData struct {
	Raw    map[string]interface{}
	Schema map[string]*FieldSchema
}

    FieldData contains the raw data and the schema that the data should adhere to

    func (*FieldData) Get

    func (d *FieldData) Get(k string) interface{}

      Get gets the value for the given field. If the key is an invalid field, FieldData will panic. If you want a safer version of this method, use GetOk. If the field k is not set, the default value (if set) will be returned, otherwise the zero value will be returned.

      func (*FieldData) GetOk

      func (d *FieldData) GetOk(k string) (interface{}, bool)

        GetOk gets the value for the given field. The second return value will be false if the key is invalid or the key is not set at all.

        func (*FieldData) GetOkErr

        func (d *FieldData) GetOkErr(k string) (interface{}, bool, error)

          GetOkErr is the most conservative of all the Get methods. It returns whether key is set or not, but also an error value. The error value is non-nil if the field doesn't exist or there was an error parsing the field value.

          func (*FieldData) Validate

          func (d *FieldData) Validate() error

            Validate cycles through the raw data and validates conversions in the schema. It also checks for the existence and value of required fields.

            type FieldSchema

            type FieldSchema struct {
            	Type        FieldType
            	Default     interface{}
            	Description string
            	Required    bool
            }

              FieldSchema is a basic schema to describe the format of a configuration field

              func (*FieldSchema) DefaultOrZero

              func (s *FieldSchema) DefaultOrZero() interface{}

                DefaultOrZero returns the default value if it is set, or otherwise the zero value of the type.

                type FieldType

                type FieldType uint

                  FieldType is the enum of types that a field can be.

                  const (
                  	TypeInvalid FieldType = 0
                  	TypeString  FieldType = iota
                  	TypeInt
                  	TypeBool
                  	TypeMap
                  	TypeArray
                  )

                  func (FieldType) String

                  func (t FieldType) String() string

                  func (FieldType) Zero

                  func (t FieldType) Zero() interface{}