config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("not found") //nolint
)

Functions

func InitGlobalConfig

func InitGlobalConfig(opts ...Option) error

InitGlobalConfig init global config

Types

type Bool

type Bool interface {
	Value
	Must(ctx context.Context) bool
	Maybe(ctx context.Context) (bool, error)
}

Bool bool value reader

type Duration

type Duration interface {
	Value
	Must(ctx context.Context) time.Duration
	Maybe(ctx context.Context) (time.Duration, error)
}

Duration time duration value reader

type Float

type Float interface {
	Value
	Must(ctx context.Context) float64
	Maybe(ctx context.Context) (float64, error)
}

Float float point value reader

type Int

type Int interface {
	Value
	Must(ctx context.Context) int
	Maybe(ctx context.Context) (int, error)
}

Int int value reader

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option config init option

type String

type String interface {
	Value
	Must(ctx context.Context) string
	Maybe(ctx context.Context) (string, error)
}

String string value reader

type Time

type Time interface {
	Value
	Must(ctx context.Context) time.Time
	Maybe(ctx context.Context) (time.Time, error)
}

Time date time value readr

type UInt

type UInt interface {
	Value
	Must(ctx context.Context) uint
	Maybe(ctx context.Context) (uint, error)
}

UInt unsigned int value reader

type Value

type Value interface {
	Is() ValueType
}

Value abstract value

type ValueBool

type ValueBool string

ValueBool bool accessor

func (ValueBool) Is

func (v ValueBool) Is() ValueType

Is ...

func (ValueBool) Maybe

func (v ValueBool) Maybe(_ context.Context) (bool, error)

Maybe ...

func (ValueBool) Must

func (v ValueBool) Must(ctx context.Context) bool

Must ...

type ValueDuration

type ValueDuration string

ValueDuration duration accessor

func (ValueDuration) Is

func (v ValueDuration) Is() ValueType

Is ...

func (ValueDuration) Maybe

Maybe ...

func (ValueDuration) Must

Must ...

type ValueFloat

type ValueFloat string

ValueFloat float accessor

func (ValueFloat) Is

func (v ValueFloat) Is() ValueType

Is ...

func (ValueFloat) Maybe

func (v ValueFloat) Maybe(_ context.Context) (float64, error)

Maybe ...

func (ValueFloat) Must

func (v ValueFloat) Must(ctx context.Context) float64

Must ,,,

type ValueInt

type ValueInt string

ValueInt int accessor

func (ValueInt) Is

func (v ValueInt) Is() ValueType

Is ...

func (ValueInt) Maybe

func (v ValueInt) Maybe(_ context.Context) (int, error)

Maybe ...

func (ValueInt) Must

func (v ValueInt) Must(ctx context.Context) int

Must ...

type ValueNone

type ValueNone struct{}

ValueNone none value

func (ValueNone) Is

func (ValueNone) Is() ValueType

Is ...

type ValueString

type ValueString string

ValueString string accessor

func (ValueString) Is

func (v ValueString) Is() ValueType

Is ...

func (ValueString) Maybe

func (v ValueString) Maybe(_ context.Context) (string, error)

Maybe ...

func (ValueString) Must

func (v ValueString) Must(ctx context.Context) string

Must ...

type ValueTime

type ValueTime string

ValueTime time accessor

func (ValueTime) Is

func (v ValueTime) Is() ValueType

Is ,,,

func (ValueTime) Maybe

func (v ValueTime) Maybe(_ context.Context) (time.Time, error)

Maybe ...

func (ValueTime) Must

func (v ValueTime) Must(ctx context.Context) time.Time

Must ...

type ValueType

type ValueType int

ValueType value type ID

const (
	//NoneType none value
	NoneType ValueType = iota

	//BoolType bool value
	BoolType

	//IntType int value
	IntType

	//UIntType unsigned int value
	UIntType

	//StringType string value
	StringType

	//TimeType date time value
	TimeType

	//DurationType time duration value
	DurationType

	//FloatType float point value
	FloatType
)

type ValueUInt

type ValueUInt string

ValueUInt uint accessor

func (ValueUInt) Is

func (v ValueUInt) Is() ValueType

Is ...

func (ValueUInt) Maybe

func (v ValueUInt) Maybe(_ context.Context) (uint, error)

Maybe ...

func (ValueUInt) Must

func (v ValueUInt) Must(ctx context.Context) uint

Must ...

type WithAcceptEnvironment

type WithAcceptEnvironment struct {
	Option
	EnvPrefix string
}

WithAcceptEnvironment option

type WithDefValue

type WithDefValue struct {
	Option
	Key interface{}
	Val interface{}
}

WithDefValue option

type WithSource

type WithSource struct {
	Option
	Source io.Reader
	Type   string
}

WithSource option

type WithSourceFile

type WithSourceFile struct {
	Option
	FileName string
}

WithSourceFile option

Jump to

Keyboard shortcuts

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