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.

Reply via email to