goodbye to the Persist method that was silly

This commit is contained in:
David Dworken 2022-04-04 22:09:14 -07:00
parent e2acc6612a
commit 843bcb32b3
2 changed files with 3 additions and 9 deletions

View File

@ -191,12 +191,6 @@ func OpenLocalSqliteDb() (*gorm.DB, error) {
return db, nil
}
// TODO: DELETE THIS METHOD
func Persist(db *gorm.DB, entry HistoryEntry) error {
db.Create(&entry)
return nil
}
func Search(db *gorm.DB, query string, limit int) ([]*HistoryEntry, error) {
tokens, err := tokenize(query)
if err != nil {

View File

@ -11,7 +11,7 @@ func TestPersist(t *testing.T) {
Check(t, err)
entry := MakeFakeHistoryEntry("ls ~/")
Check(t, Persist(db, entry))
db.Create(entry)
var historyEntries []*HistoryEntry
result := db.Find(&historyEntries)
Check(t, result.Error)
@ -32,9 +32,9 @@ func TestSearch(t *testing.T) {
// Insert data
entry1 := MakeFakeHistoryEntry("ls /foo")
Check(t, Persist(db, entry1))
db.Create(entry1)
entry2 := MakeFakeHistoryEntry("ls /bar")
Check(t, Persist(db, entry2))
db.Create(entry2)
// Search for data
results, err := Search(db, "ls", 5)