Remove old FieldSeeker tables, use v2 generated tables.

This requires a bunch of changes since the types on these tables are
much closer to the underlying types of the Fieldseeker data we are
getting back from the API.

I now need to use proper UUID types everywhere, which means I had to
modify the bob gen config to consistently use google UUID, my UUID
library of choice.

I also had to add the organization_id to all the fieldseeker tables
since we rely on them existing for some of our compound queries.

There were some changes to the API type signatures to get things to
build. I may yet regret those.
This commit is contained in:
Eli Ribble 2025-12-24 17:49:39 -07:00
parent 58f5afccc9
commit 1395e3d3ac
445 changed files with 54077 additions and 275856 deletions

View file

@ -1,4 +1,4 @@
// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT.
// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
package sql
@ -8,7 +8,9 @@ import (
_ "embed"
"io"
"iter"
"time"
"github.com/google/uuid"
"github.com/stephenafamo/bob"
"github.com/stephenafamo/bob/dialect/psql"
"github.com/stephenafamo/bob/dialect/psql/dialect"
@ -20,11 +22,11 @@ import (
//go:embed trapdata_by_location_id_recent.bob.sql
var formattedQueries_trapdata_by_location_id_recent string
var trapDataByLocationIDRecentSQL = formattedQueries_trapdata_by_location_id_recent[199:489]
var trapDataByLocationIDRecentSQL = formattedQueries_trapdata_by_location_id_recent[199:498]
type TrapDataByLocationIDRecentQuery = orm.ModQuery[*dialect.SelectQuery, trapDataByLocationIDRecent, TrapDataByLocationIDRecentRow, []TrapDataByLocationIDRecentRow, trapDataByLocationIDRecentTransformer]
func TrapDataByLocationIDRecent(OrganizationID int32, LocID []string) *TrapDataByLocationIDRecentQuery {
func TrapDataByLocationIDRecent(OrganizationID int32, LocID []uuid.UUID) *TrapDataByLocationIDRecentQuery {
var expressionTypArgs trapDataByLocationIDRecent
expressionTypArgs.OrganizationID = psql.Arg(OrganizationID)
@ -53,17 +55,17 @@ func TrapDataByLocationIDRecent(OrganizationID int32, LocID []string) *TrapDataB
},
Mod: bob.ModFunc[*dialect.SelectQuery](func(q *dialect.SelectQuery) {
q.AppendSelect(expressionTypArgs.subExpr(7, 36))
q.SetTable(expressionTypArgs.subExpr(42, 244))
q.AppendWhere(expressionTypArgs.subExpr(251, 264))
q.CombinedOrder.AppendOrder(expressionTypArgs.subExpr(274, 290))
q.SetTable(expressionTypArgs.subExpr(42, 253))
q.AppendWhere(expressionTypArgs.subExpr(260, 273))
q.CombinedOrder.AppendOrder(expressionTypArgs.subExpr(283, 299))
}),
}
}
type TrapDataByLocationIDRecentRow = struct {
Enddatetime int64 `db:"enddatetime"`
Globalid string `db:"globalid"`
LocID string `db:"loc_id"`
Enddatetime time.Time `db:"enddatetime"`
Globalid uuid.UUID `db:"globalid"`
LocID uuid.UUID `db:"loc_id"`
}
type trapDataByLocationIDRecentTransformer = bob.SliceTransformer[TrapDataByLocationIDRecentRow, []TrapDataByLocationIDRecentRow]
@ -77,8 +79,8 @@ func (o trapDataByLocationIDRecent) args() iter.Seq[orm.ArgWithPosition] {
return func(yield func(arg orm.ArgWithPosition) bool) {
if !yield(orm.ArgWithPosition{
Name: "organizationID",
Start: 207,
Stop: 209,
Start: 216,
Stop: 218,
Expression: o.OrganizationID,
}) {
return
@ -86,8 +88,8 @@ func (o trapDataByLocationIDRecent) args() iter.Seq[orm.ArgWithPosition] {
if !yield(orm.ArgWithPosition{
Name: "locID",
Start: 227,
Stop: 229,
Start: 236,
Stop: 238,
Expression: o.LocID,
}) {
return