package config import ( "context" "time" ) type Provider interface { GetValue(ctx context.Context, key Key) Value } type Key string type Value interface { Int() int String() string Float() float32 Duration() time.Duration } type DurationValue time.Duration type FloatValue struct { EmptyValue Val float32 } func (v FloatValue) Float() float32 { return v.Val } type StringValue struct { EmptyValue Val string } func (v StringValue) String() string { return v.Val } type IntValue struct { EmptyValue Val int } func (v IntValue) Int() int { return v.Val } func (v IntValue) Float() float32 { return float32(v.Val) } type EmptyValue struct{} func (v EmptyValue) Int() int { return 0 } func (v EmptyValue) String() string { return "" } func (v EmptyValue) Float() float32 { return 0 } func (v EmptyValue) Duration() time.Duration { return 0 }