mirror of
https://github.com/ddworken/hishtory.git
synced 2025-01-23 06:38:52 +01:00
goodbye to the Persist method that was silly
This commit is contained in:
parent
e2acc6612a
commit
843bcb32b3
@ -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 {
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user