Documentation
¶
Index ¶
- Variables
- func GetBooleanProperty(ctx context.Context, getter Getter, name string, defVal bool) (res bool, err error)
- func GetDurationProperty(ctx context.Context, getter Getter, name string, defVal time.Duration) (res time.Duration, err error)
- func GetFloatProperty(ctx context.Context, getter Getter, name string, defVal float64) (res float64, err error)
- func GetIntegerProperty(ctx context.Context, getter Getter, name string, defVal int64) (res int64, err error)
- func GetJsonProperty(ctx context.Context, getter Getter, name string, defVal json.RawMessage) (res json.RawMessage, err error)
- func GetStringProperty(ctx context.Context, getter Getter, name string, defVal string) (res string, err error)
- type BooleanType
- type DurationType
- func (that *DurationType) Cast(v interface{}, defaults time.Duration) time.Duration
- func (that *DurationType) Get(ctx context.Context, getter Getter, name string, defVal time.Duration) (res time.Duration, err error)
- func (that *DurationType) Is(value interface{}) bool
- func (that *DurationType) TryCast(value interface{}) (time.Duration, bool)
- type FloatType
- func (that *FloatType) Cast(v interface{}, defaults float64) float64
- func (that *FloatType) Get(ctx context.Context, getter Getter, name string, defVal float64) (res float64, err error)
- func (that *FloatType) Is(value interface{}) bool
- func (that *FloatType) TryCast(value interface{}) (float64, bool)
- type Getter
- type IntegerType
- type JsonType
- func (that *JsonType) Cast(v interface{}, defaults json.RawMessage) json.RawMessage
- func (that *JsonType) Get(ctx context.Context, getter Getter, name string, defVal json.RawMessage) (res json.RawMessage, err error)
- func (that *JsonType) Is(value interface{}) bool
- func (that *JsonType) TryCast(value interface{}) (json.RawMessage, bool)
- type Setter
- type StringType
- func (that *StringType) Cast(v interface{}, defaults string) string
- func (that *StringType) Get(ctx context.Context, getter Getter, name string, defVal string) (res string, err error)
- func (that *StringType) Is(value interface{}) bool
- func (that *StringType) TryCast(value interface{}) (string, bool)
- type TypeChecker
- type Typer
- type Types
Constants ¶
This section is empty.
Variables ¶
View Source
var GetErrNoMatch = func() error {
return errNoMatch
}
View Source
var Type = &Types{ Boolean: &BooleanType{}, Integer: &IntegerType{}, Float: &FloatType{}, String: &StringType{}, Duration: &DurationType{}, Json: &JsonType{}, }
Functions ¶
func GetBooleanProperty ¶
func GetBooleanProperty( ctx context.Context, getter Getter, name string, defVal bool, ) (res bool, err error)
GetBooleanProperty is helper for get boolean property from the getter
func GetDurationProperty ¶
func GetDurationProperty( ctx context.Context, getter Getter, name string, defVal time.Duration, ) (res time.Duration, err error)
GetDurationProperty is helper for get duration property from the getter
func GetFloatProperty ¶
func GetFloatProperty( ctx context.Context, getter Getter, name string, defVal float64, ) (res float64, err error)
GetFloatProperty is helper for get float property from the getter
func GetIntegerProperty ¶
func GetIntegerProperty( ctx context.Context, getter Getter, name string, defVal int64, ) (res int64, err error)
GetIntegerProperty is helper for get integer property from the getter
func GetJsonProperty ¶
func GetJsonProperty( ctx context.Context, getter Getter, name string, defVal json.RawMessage, ) (res json.RawMessage, err error)
GetJsonProperty is helper for get duration property from the getter
Types ¶
type BooleanType ¶
type BooleanType struct{}
func (*BooleanType) Cast ¶
func (that *BooleanType) Cast(v interface{}, defaults bool) bool
func (*BooleanType) Is ¶
func (that *BooleanType) Is(value interface{}) bool
func (*BooleanType) TryCast ¶
func (that *BooleanType) TryCast(value interface{}) (bool, bool)
type DurationType ¶
type DurationType struct{}
func (*DurationType) Cast ¶
func (that *DurationType) Cast(v interface{}, defaults time.Duration) time.Duration
func (*DurationType) Is ¶
func (that *DurationType) Is(value interface{}) bool
type IntegerType ¶
type IntegerType struct{}
func (*IntegerType) Cast ¶
func (that *IntegerType) Cast(v interface{}, defaults int64) int64
func (*IntegerType) Is ¶
func (that *IntegerType) Is(value interface{}) bool
func (*IntegerType) TryCast ¶
func (that *IntegerType) TryCast(value interface{}) (int64, bool)
type JsonType ¶
type JsonType struct { }
func (*JsonType) Cast ¶
func (that *JsonType) Cast(v interface{}, defaults json.RawMessage) json.RawMessage
type StringType ¶
type StringType struct{}
func (*StringType) Cast ¶
func (that *StringType) Cast(v interface{}, defaults string) string
func (*StringType) Is ¶
func (that *StringType) Is(value interface{}) bool
func (*StringType) TryCast ¶
func (that *StringType) TryCast(value interface{}) (string, bool)
type TypeChecker ¶
type TypeChecker interface {
Is(value interface{}) bool
}
Click to show internal directories.
Click to hide internal directories.