From 0afb8d48bd33648ac8a1624d67dfb32498c30331 Mon Sep 17 00:00:00 2001 From: saji Date: Sat, 24 Feb 2024 22:57:17 -0600 Subject: [PATCH] wip: cleanup --- http.go | 2 +- internal/db/getters.go | 37 ------------------------------------- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/http.go b/http.go index cbd80c6..be68cee 100644 --- a/http.go +++ b/http.go @@ -77,7 +77,7 @@ func apiV1(broker *Broker, db *db.TelemDb) chi.Router { }) // this is to get a single field - r.Get("/{name:[a-z_]+}/{field:[a-z_]+}") + r.Get("/{name:[a-z_]+}/{field:[a-z_]+}", apiV1GetValues(db)) }) diff --git a/internal/db/getters.go b/internal/db/getters.go index c1925c7..1b55d9f 100644 --- a/internal/db/getters.go +++ b/internal/db/getters.go @@ -3,7 +3,6 @@ package db import ( "context" "fmt" - "strings" "time" ) @@ -25,42 +24,6 @@ type BusEventFilter struct { TimerangeEnd time.Time } -func (bef *BusEventFilter) String() string { - var sb []string = make([]string, 0, 2) - if len(bef.Names) > 0 { - names := strings.Join(bef.Names, ",") - sb = append(sb, fmt.Sprintf("name IN (%s)", names)) - } - if !bef.TimerangeStart.IsZero() && !bef.TimerangeEnd.IsZero() { - sb = append(sb, fmt.Sprintf("")) - } - return "" -} - -type BusEventElement interface { - Element() string -} - -type NormalExtract struct { - Key string -} - -type JSONExtract struct { - Key string -} - -type BusEventQuery struct { - Elements []BusEventElement - Filter BusEventFilter - Limits LimitOffsetModifier -} - -func (beq *BusEventQuery) String() string { - // select - return "" -} - - // now we can optionally add a limit. // Datum is a single measurement - it is more granular than a packet.