feat(go): add post raw frame query

This commit is contained in:
lingniu
2026-07-03 14:54:52 +08:00
parent c0d3b41550
commit 28c81611a1
4 changed files with 169 additions and 4 deletions

View File

@@ -135,7 +135,9 @@ func main() {
healthChecks = append(healthChecks, health.Check{Name: "tdengine", Check: db.PingContext})
closeHistory = func() { _ = db.Close() }
database := env("TDENGINE_DATABASE", history.DefaultDatabase)
mux.Handle("/api/history/raw-frames", history.NewRawFrameHandler(history.NewRawFrameRepository(db, database)))
rawFrameHandler := history.NewRawFrameHandler(history.NewRawFrameRepository(db, database))
mux.Handle("/api/history/raw-frames", rawFrameHandler)
mux.Handle("/api/history/raw-frames/query", rawFrameHandler)
mux.Handle("/api/history/locations", history.NewLocationHandler(history.NewLocationRepository(db, database)))
logger.Info("history query enabled", "driver", driver, "database", database)
} else {
@@ -145,6 +147,7 @@ func main() {
_ = json.NewEncoder(w).Encode(map[string]any{"error": "TDENGINE_DSN is not configured"})
}
mux.HandleFunc("/api/history/raw-frames", historyUnavailable)
mux.HandleFunc("/api/history/raw-frames/query", historyUnavailable)
mux.HandleFunc("/api/history/locations", historyUnavailable)
logger.Warn("TDENGINE_DSN is empty; history query api disabled")
}