From 96e68148369e4076bcee45f91810669e4898c59e Mon Sep 17 00:00:00 2001 From: JP Appel Date: Thu, 12 Jun 2025 02:14:18 -0400 Subject: Fix comparison against wrong zero value for times --- pkg/data/put.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'pkg/data/put.go') diff --git a/pkg/data/put.go b/pkg/data/put.go index a665dfc..ac0dabc 100644 --- a/pkg/data/put.go +++ b/pkg/data/put.go @@ -88,11 +88,9 @@ func (p PutMany) Insert(ctx context.Context) error { func (p *Put) document() error { title := sql.NullString{String: p.Doc.Title, Valid: p.Doc.Title != ""} - dateUnix := p.Doc.Date.Unix() - date := sql.NullInt64{Int64: dateUnix, Valid: dateUnix != 0} + date := sql.NullInt64{Int64: p.Doc.Date.Unix(), Valid: !p.Doc.Date.IsZero()} - filetimeUnix := p.Doc.FileTime.Unix() - filetime := sql.NullInt64{Int64: filetimeUnix, Valid: filetimeUnix != 0} + filetime := sql.NullInt64{Int64: p.Doc.FileTime.Unix(), Valid: !p.Doc.FileTime.IsZero()} meta := sql.NullString{String: p.Doc.OtherMeta, Valid: p.Doc.OtherMeta != ""} -- cgit v1.2.3