aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/data/put.go
diff options
context:
space:
mode:
authorJP Appel <jeanpierre.appel01@gmail.com>2025-07-19 19:01:39 -0400
committerJP Appel <jeanpierre.appel01@gmail.com>2025-07-19 19:01:39 -0400
commitfaf35ef54885bc48b897508ce3cb40b868ff505b (patch)
tree5ff54c8a73567df3c139e0471f7882971fb0f91e /pkg/data/put.go
parent08434926f5eda975808f66b45b3a828458d5ba7e (diff)
Add key-val db table for metadata
Diffstat (limited to 'pkg/data/put.go')
-rw-r--r--pkg/data/put.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkg/data/put.go b/pkg/data/put.go
index 98cb6ba..6631eb0 100644
--- a/pkg/data/put.go
+++ b/pkg/data/put.go
@@ -4,6 +4,7 @@ import (
"context"
"database/sql"
"fmt"
+ "time"
"github.com/jpappel/atlas/pkg/index"
)
@@ -66,6 +67,13 @@ func (p *Put) Insert(ctx context.Context) error {
return err
}
+ if _, err := p.tx.Exec("INSERT OR REPLACE INTO Info(key,value,updated) VALUES (?,?,?)",
+ "lastUpdate", "singlePut", time.Now().UTC().Unix(),
+ ); err != nil {
+ p.tx.Rollback()
+ return err
+ }
+
return p.tx.Commit()
}
@@ -86,6 +94,12 @@ func (p PutMany) Insert() error {
return fmt.Errorf("failed to insert authors: %v", err)
}
+ if _, err := p.db.ExecContext(p.ctx, "INSERT OR REPLACE INTO Info(key,value,updated) VALUES (?,?,?)",
+ "lastUpdate", "multiPut", time.Now().UTC().Unix(),
+ ); err != nil {
+ return err
+ }
+
return nil
}