diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2025-06-12 02:14:18 -0400 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2025-06-12 02:14:18 -0400 |
| commit | 96e68148369e4076bcee45f91810669e4898c59e (patch) | |
| tree | 6a636d59cc3773bd48a478eb5e17873bd792ef21 /pkg/data/put.go | |
| parent | 3471cc1068a207ea317161313ab514d1b180b357 (diff) | |
Fix comparison against wrong zero value for times
Diffstat (limited to 'pkg/data/put.go')
| -rw-r--r-- | pkg/data/put.go | 6 |
1 files changed, 2 insertions, 4 deletions
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 != ""} |
