aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Appel <jeanpierre.appel01@gmail.com>2025-06-12 02:32:48 -0400
committerJP Appel <jeanpierre.appel01@gmail.com>2025-06-12 02:32:48 -0400
commit61d89ee58e6a4d990e6e81c951731c80c2cd1ece (patch)
tree9c205528083ec7a22f9a508a23cd0a1dca9c9be7
parenteec51c3c4c5cde3135a8219cff8e6e0e54918918 (diff)
Minor bug fix
-rw-r--r--pkg/data/put.go6
-rw-r--r--pkg/index/index.go5
2 files changed, 5 insertions, 6 deletions
diff --git a/pkg/data/put.go b/pkg/data/put.go
index ac0dabc..a5237ae 100644
--- a/pkg/data/put.go
+++ b/pkg/data/put.go
@@ -131,11 +131,9 @@ func (p *PutMany) documents(ctx context.Context) error {
// future inserts
for _, doc := range p.pathDocs {
title := sql.NullString{String: doc.Title, Valid: doc.Title != ""}
- dateUnix := doc.Date.Unix()
- date := sql.NullInt64{Int64: dateUnix, Valid: dateUnix != 0}
+ date := sql.NullInt64{Int64: doc.Date.Unix(), Valid: !doc.Date.IsZero()}
- filetimeUnix := doc.FileTime.Unix()
- filetime := sql.NullInt64{Int64: filetimeUnix, Valid: filetimeUnix != 0}
+ filetime := sql.NullInt64{Int64: doc.FileTime.Unix(), Valid: !doc.FileTime.IsZero()}
meta := sql.NullString{String: doc.OtherMeta, Valid: doc.OtherMeta != ""}
diff --git a/pkg/index/index.go b/pkg/index/index.go
index 5d23e14..a96c227 100644
--- a/pkg/index/index.go
+++ b/pkg/index/index.go
@@ -120,9 +120,10 @@ func (doc *Document) parseDateNode(node ast.Node) error {
return nil
}
- var err error
- if doc.Date, err = util.ParseDateTime(dateStr); err != nil {
+ if date, err := util.ParseDateTime(dateStr); err != nil {
return fmt.Errorf("Unable to parse date: %s", dateNode.Value)
+ } else {
+ doc.Date = date
}
return nil