Add Numeric.Getter
This commit is contained in:
@@ -62,11 +62,13 @@ type Numeric struct {
|
|||||||
Valid bool
|
Valid bool
|
||||||
|
|
||||||
NumericDecoderWrapper func(interface{}) NumericDecoder
|
NumericDecoderWrapper func(interface{}) NumericDecoder
|
||||||
|
Getter func(Numeric) interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Numeric) NewTypeValue() Value {
|
func (n *Numeric) NewTypeValue() Value {
|
||||||
return &Numeric{
|
return &Numeric{
|
||||||
NumericDecoderWrapper: n.NumericDecoderWrapper,
|
NumericDecoderWrapper: n.NumericDecoderWrapper,
|
||||||
|
Getter: n.Getter,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,6 +260,10 @@ func (dst *Numeric) Set(src interface{}) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (dst Numeric) Get() interface{} {
|
func (dst Numeric) Get() interface{} {
|
||||||
|
if dst.Getter != nil {
|
||||||
|
return dst.Getter(dst)
|
||||||
|
}
|
||||||
|
|
||||||
if !dst.Valid {
|
if !dst.Valid {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user