From faf35ef54885bc48b897508ce3cb40b868ff505b Mon Sep 17 00:00:00 2001 From: JP Appel Date: Sat, 19 Jul 2025 19:01:39 -0400 Subject: Add key-val db table for metadata --- pkg/data/put.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'pkg/data/put.go') 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 } -- cgit v1.2.3