Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AnyToOptionalString = data.FieldConverter{ OutputFieldType: data.FieldTypeNullableString, Converter: func(v interface{}) (interface{}, error) { if v == nil { return nil, nil } str := fmt.Sprintf("%+v", v) return &str, nil }, }
AnyToOptionalString any value as a string
View Source
var BoolNOOP = data.FieldConverter{ OutputFieldType: data.FieldTypeBool, }
BoolNOOP .....
View Source
var BoolToOptionalBool = data.FieldConverter{ OutputFieldType: data.FieldTypeNullableBool, Converter: func(v interface{}) (interface{}, error) { if v == nil { return nil, nil } val, ok := v.(bool) if !ok { return nil, fmt.Errorf("[bool] expected bool input but got type %T", v) } return &val, nil }, }
BoolToOptionalBool optional int value
View Source
var Boolean = data.FieldConverter{ OutputFieldType: data.FieldTypeBool, Converter: func(v interface{}) (interface{}, error) { fV, ok := v.(bool) if !ok { return nil, fmt.Errorf("[ms] expected bool input but got type %T", v) } return fV, nil }, }
Boolean ...
View Source
var Float64EpochMillisToTime = data.FieldConverter{ OutputFieldType: data.FieldTypeTime, Converter: func(v interface{}) (interface{}, error) { fV, ok := v.(float64) if !ok { return nil, fmt.Errorf("[ms] expected float64 input but got type %T", v) } return time.Unix(0, int64(fV)*int64(time.Millisecond)).UTC(), nil }, }
Float64EpochMillisToTime convert to time
View Source
var Float64EpochSecondsToTime = data.FieldConverter{ OutputFieldType: data.FieldTypeTime, Converter: func(v interface{}) (interface{}, error) { fV, ok := v.(float64) if !ok { return nil, fmt.Errorf("[seconds] expected float64 input but got type %T", v) } return time.Unix(int64(fV), 0).UTC(), nil }, }
Float64EpochSecondsToTime numeric seconds to time
View Source
var Float64NOOP = data.FieldConverter{ OutputFieldType: data.FieldTypeFloat64, }
Float64NOOP .....
View Source
var Float64ToOptionalFloat64 = data.FieldConverter{ OutputFieldType: data.FieldTypeNullableFloat64, Converter: func(v interface{}) (interface{}, error) { if v == nil { return nil, nil } val, ok := v.(float64) if !ok { return nil, fmt.Errorf("[float] expected float64 input but got type %T", v) } return &val, nil }, }
Float64ToOptionalFloat64 optional float value
View Source
var Int64NOOP = data.FieldConverter{ OutputFieldType: data.FieldTypeInt64, }
Int64NOOP .....
View Source
var Int64ToOptionalInt64 = data.FieldConverter{ OutputFieldType: data.FieldTypeNullableInt64, Converter: func(v interface{}) (interface{}, error) { if v == nil { return nil, nil } val, ok := v.(int64) if !ok { return nil, fmt.Errorf("[int] expected int64 input but got type %T", v) } return &val, nil }, }
Int64ToOptionalInt64 optional int value
View Source
var StringNOOP = data.FieldConverter{ OutputFieldType: data.FieldTypeString, }
StringNOOP value is already in the proper format
View Source
var StringToOptionalFloat64 = data.FieldConverter{ OutputFieldType: data.FieldTypeNullableFloat64, Converter: func(v interface{}) (interface{}, error) { if v == nil { return nil, nil } val, ok := v.(string) if !ok { return nil, fmt.Errorf("[floatz] expected string input but got type %T", v) } fV, err := strconv.ParseFloat(val, 64) return &fV, err }, }
StringToOptionalFloat64 string to float
View Source
var TimeToTime = data.FieldConverter{ OutputFieldType: data.FieldTypeTime, Converter: func(v interface{}) (interface{}, error) { if v == nil { return nil, nil } val, ok := v.(time.Time) if !ok { return nil, fmt.Errorf("[time] expected time.Time input but got type %T", v) } return val, nil }, }
View Source
var UInt64ToOptionalUInt64 = data.FieldConverter{ OutputFieldType: data.FieldTypeNullableUint64, Converter: func(v interface{}) (interface{}, error) { if v == nil { return nil, nil } val, ok := v.(uint64) if !ok { return nil, fmt.Errorf("[uint] expected uint64 input but got type %T", v) } return &val, nil }, }
UInt64ToOptionalUInt64 optional int value
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.