package pq import ( "testing" "time" ) func TestScanTimestamp(t *testing.T) { var nt NullTime tn := time.Now() (&nt).Scan(tn) if !nt.Valid { t.Errorf("Expected Valid=false") } if nt.Time != tn { t.Errorf("Time value mismatch") } } func TestScanNilTimestamp(t *testing.T) { var nt NullTime (&nt).Scan(nil) if nt.Valid { t.Errorf("Expected Valid=false") } }