68347e8b95
abandon generic query frag for common structures Instead of using the QueryFrag struct, which was too generic to be generally useful, we have moved to a BusEventFilter type, which contains things we may filter on when we're searching for bus events. At the moment it just contains names, and start/stop times. Then in each function we can accept this filter struct and convert it to fit the query. We also support general modifiers, and currently have one implemented: the LimitOffsetModifier. This adds a LIMIT and OFFSET clause to any statement. these are all applied at the end and receive a stringbuilder which may prevent certain operations from being structured. We need to work on this one more, potentially abandoning.
15 lines
365 B
SQL
15 lines
365 B
SQL
CREATE TABLE "bus_events" (
|
|
"ts" INTEGER NOT NULL, -- timestamp, unix milliseconds
|
|
"name" TEXT NOT NULL, -- name of base packet
|
|
"data" JSON NOT NULL CHECK(json_valid(data)) -- JSON object describing the data, including index if any
|
|
);
|
|
|
|
CREATE INDEX "ids_timestamped" ON "bus_events" (
|
|
"name",
|
|
"ts" DESC
|
|
);
|
|
|
|
CREATE INDEX "times" ON "bus_events" (
|
|
"ts" DESC
|
|
);
|