feat: fix db and recode judge

This commit is contained in:
d3m0k1d
2026-01-13 21:03:10 +03:00
parent b2d03a4008
commit f0180b4bbe
5 changed files with 57 additions and 43 deletions

View File

@@ -6,28 +6,13 @@ import (
func Write(db *DB, resultCh <-chan *LogEntry) {
for result := range resultCh {
path := ""
if result.Path != nil {
path = *result.Path
}
status := ""
if result.Status != nil {
status = *result.Status
}
method := ""
if result.Method != nil {
method = *result.Method
}
_, err := db.db.Exec(
"INSERT INTO requests (service, ip, path, method, status, created_at) VALUES (?, ?, ?, ?, ?, ?)",
result.Service,
result.IP,
path,
method,
status,
result.Path,
result.Method,
result.Status,
time.Now().Format(time.RFC3339),
)
if err != nil {