env

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

dict is a helper function that allow one to easily get concreate values out of a map[string]interface{}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseBool

func ParseBool(v interface{}) (*bool, error)

func ParseBoolSlice

func ParseBoolSlice(val string) ([]bool, error)

func ParseFloat

func ParseFloat(v interface{}) (*float64, error)

func ParseFloatSlice

func ParseFloatSlice(val string) ([]float64, error)

func ParseInt

func ParseInt(v interface{}) (*int, error)

func ParseIntSlice

func ParseIntSlice(val string) ([]int, error)

func ParseString

func ParseString(v interface{}) (*string, error)

func ParseStringSlice

func ParseStringSlice(val string) ([]string, error)

func ParseUint

func ParseUint(v interface{}) (*uint, error)

func ParseUintSlice

func ParseUintSlice(val string) ([]uint, error)

Types

type Bool

type Bool bool

func BoolPtr

func BoolPtr(v Bool) *Bool

func (*Bool) UnmarshalTOML

func (t *Bool) UnmarshalTOML(v interface{}) error

type Dict

type Dict map[string]interface{}

func (Dict) Bool

func (d Dict) Bool(key string, def *bool) (v bool, err error)

Bool returns the value as a string type, if it is unable to convert the value it will error. If the default value is not provided, and it can not find the value, it will return the zero value, and an error.

func (Dict) BoolSlice

func (d Dict) BoolSlice(key string) (v []bool, err error)

func (Dict) Dict

func (d Dict) Dict(key string) (v Dict, err error)

Dict is to obtain a map[string]interface{} that has already been cast to a M type.

func (Dict) Float

func (d Dict) Float(key string, def *float64) (v float64, err error)

Float returns the value as a uint type, if it is unable to convert the value it will error. If the default value is not provided, and it can not find the value, it will return the zero value, and an error.

func (Dict) FloatSlice

func (d Dict) FloatSlice(key string) (v []float64, err error)

func (Dict) Int

func (d Dict) Int(key string, def *int) (v int, err error)

Int returns the value as a int type, if it is unable to convert the value it will error. If the default value is not provided, and it can not find the value, it will return the zero value, and an error.

func (Dict) IntSlice

func (d Dict) IntSlice(key string) (v []int, err error)

func (Dict) Interface

func (d Dict) Interface(key string) (v interface{}, ok bool)

func (Dict) Map

func (d Dict) Map(key string) (r dict.Dicter, err error)

func (Dict) MapSlice

func (d Dict) MapSlice(key string) (r []dict.Dicter, err error)

func (Dict) String

func (d Dict) String(key string, def *string) (v string, err error)

String returns the value as a string type, if it is unable to convert the value it will error. If the default value is not provided, and it can not find the value, it will return the zero value, and an error.

func (Dict) StringSlice

func (d Dict) StringSlice(key string) (v []string, err error)

func (Dict) Uint

func (d Dict) Uint(key string, def *uint) (v uint, err error)

Uint returns the value as a uint type, if it is unable to convert the value it will error. If the default value is not provided, and it can not find the value, it will return the zero value, and an error.

func (Dict) UintSlice

func (d Dict) UintSlice(key string) (v []uint, err error)

type ErrEnvVar

type ErrEnvVar string

ErrEnvVar corresponds with a missing environment variable

func (ErrEnvVar) Error

func (e ErrEnvVar) Error() string

type ErrType

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

ErrType corresponds with an incorrect type passed to UnmarshalTOML

func (ErrType) Error

func (te ErrType) Error() string

type Float

type Float float64

func FloatPtr

func FloatPtr(v Float) *Float

func (*Float) UnmarshalTOML

func (t *Float) UnmarshalTOML(v interface{}) error

type Int

type Int int

func IntPtr

func IntPtr(v Int) *Int

func (*Int) UnmarshalTOML

func (t *Int) UnmarshalTOML(v interface{}) error

type String

type String string

func StringPtr

func StringPtr(v String) *String

func (*String) UnmarshalTOML

func (t *String) UnmarshalTOML(v interface{}) error

type Uint

type Uint uint

func UintPtr

func UintPtr(v Uint) *Uint

func (*Uint) UnmarshalTOML

func (t *Uint) UnmarshalTOML(v interface{}) error

Jump to

Keyboard shortcuts

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