File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,13 @@ func Scan(b []byte, v interface{}) error {
105105 var err error
106106 * v , err = time .Parse (time .RFC3339Nano , util .BytesToString (b ))
107107 return err
108+ case * time.Duration :
109+ n , err := util .ParseInt (b , 10 , 64 )
110+ if err != nil {
111+ return err
112+ }
113+ * v = time .Duration (n )
114+ return nil
108115 case encoding.BinaryUnmarshaler :
109116 return v .UnmarshalBinary (b )
110117 default :
Original file line number Diff line number Diff line change @@ -98,6 +98,8 @@ func (w *Writer) WriteArg(v interface{}) error {
9898 case time.Time :
9999 w .numBuf = v .AppendFormat (w .numBuf [:0 ], time .RFC3339Nano )
100100 return w .bytes (w .numBuf )
101+ case time.Duration :
102+ return w .int (v .Nanoseconds ())
101103 case encoding.BinaryMarshaler :
102104 b , err := v .MarshalBinary ()
103105 if err != nil {
You can’t perform that action at this time.
0 commit comments