I prefer to work with milliseconds, this is suitable in any language,
os and applications.

2017-12-10 17:26 GMT-04:00 Liviu G <livi...@gmail.com>:
> Does anyone know why we don't have a NullTime like NullString in
> database/sql package ?
> We shouldn't need to copy/paste this code in various projects
> or depend on the driver specific NullTime (for postgres for example), right
> ?
>
> type NullTime struct {
>
>     time.Time
>
>     Valid bool
>
> }
>
>
> func (this *NullTime) Scan(value interface{}) error {
>
>     this.Time, this.Valid = value.(time.Time)
>
>     return nil
>
> }
>
>
> func (this NullTime) Value() (driver.Value, error) {
>
>     if !this.Valid {
>
>         return nil, nil
>
>     }
>
>     return this.Time, nil
>
> }
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to