Add history record struct and collect timestamps for query history
This commit is contained in:
21
history.go
Normal file
21
history.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type HistoryRecord struct {
|
||||
Query string `json:"query"`
|
||||
Timestamp string `json:"timestamp"`
|
||||
}
|
||||
|
||||
func NewHistory() []HistoryRecord {
|
||||
return make([]HistoryRecord, 0)
|
||||
}
|
||||
|
||||
func NewHistoryRecord(query string) HistoryRecord {
|
||||
return HistoryRecord{
|
||||
Query: query,
|
||||
Timestamp: time.Now().String(),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user