@@ -42,7 +42,12 @@ func DatetimeValue(v uint32) Value { return value.DatetimeValue(v) }
4242
4343func TimestampValue (v uint64 ) Value { return value .TimestampValue (v ) }
4444
45+ // IntervalValueFromMicroseconds makes Value from given microseconds value
46+ func IntervalValueFromMicroseconds (v int64 ) Value { return value .IntervalValue (v ) }
47+
4548// IntervalValue makes Value from given microseconds value
49+ //
50+ // Deprecated: use IntervalValueFromMicroseconds instead
4651func IntervalValue (v int64 ) Value { return value .IntervalValue (v ) }
4752
4853// TzDateValue makes TzDate value from string
@@ -392,13 +397,23 @@ func NullableTzTimestampValueFromTime(v *time.Time) Value {
392397 return OptionalValue (TzTimestampValueFromTime (* v ))
393398}
394399
400+ // NullableIntervalValue makes Value which maybe nil or valued
401+ //
402+ // Deprecated: use NullableIntervalValueFromMicroseconds instead
395403func NullableIntervalValue (v * int64 ) Value {
396404 if v == nil {
397405 return NullValue (TypeInterval )
398406 }
399407 return OptionalValue (IntervalValue (* v ))
400408}
401409
410+ func NullableIntervalValueFromMicroseconds (v * int64 ) Value {
411+ if v == nil {
412+ return NullValue (TypeInterval )
413+ }
414+ return OptionalValue (IntervalValueFromMicroseconds (* v ))
415+ }
416+
402417func NullableIntervalValueFromDuration (v * time.Duration ) Value {
403418 if v == nil {
404419 return NullValue (TypeInterval )
@@ -540,7 +555,7 @@ func Nullable(t Type, v interface{}) Value {
540555 case TypeInterval :
541556 switch tt := v .(type ) {
542557 case * int64 :
543- return NullableIntervalValue (tt )
558+ return NullableIntervalValueFromMicroseconds (tt )
544559 case * time.Duration :
545560 return NullableIntervalValueFromDuration (tt )
546561 default :
0 commit comments