chore(go): new chat message db repository. Closes #3081 (#4161)

This commit is contained in:
Gabe Kangas
2025-01-20 16:32:25 -08:00
committed by GitHub
parent db0ddfe009
commit c1f4096e11
15 changed files with 604 additions and 507 deletions

View File

@ -107,19 +107,11 @@ func (ds *Datastore) Save(e models.ConfigEntry) error {
return nil
}
// Setup will create the datastore table and perform initial initialization.
// Setup will perform initial initialization.
func (ds *Datastore) Setup() {
ds.cache = make(map[string][]byte)
ds.DB = GetDatabase()
ds.DbLock = &sync.Mutex{}
createTableSQL := `CREATE TABLE IF NOT EXISTS datastore (
"key" string NOT NULL PRIMARY KEY,
"value" BLOB,
"timestamp" DATE DEFAULT CURRENT_TIMESTAMP NOT NULL
);`
ds.MustExec(createTableSQL)
}
// Reset will delete all config entries in the datastore and start over.