This is an intermediate step between shifting from the old fs_* prefixed table names to an entire fieldseeker schema. At this point we have both, and we aren't doing much with the new schema but compiling.
106 lines
3.4 KiB
Go
106 lines
3.4 KiB
Go
// Code generated by BobGen psql v0.42.0. DO NOT EDIT.
|
|
// This file is meant to be re-generated in place and/or deleted at any time.
|
|
|
|
package sql
|
|
|
|
import (
|
|
"context"
|
|
_ "embed"
|
|
"io"
|
|
"iter"
|
|
|
|
"github.com/stephenafamo/bob"
|
|
"github.com/stephenafamo/bob/dialect/psql"
|
|
"github.com/stephenafamo/bob/dialect/psql/dialect"
|
|
"github.com/stephenafamo/bob/orm"
|
|
"github.com/stephenafamo/scan"
|
|
)
|
|
|
|
//go:embed traplocation_by_source_id.bob.sql
|
|
var formattedQueries_traplocation_by_source_id string
|
|
|
|
var trapLocationBySourceIDSQL = formattedQueries_traplocation_by_source_id[160:411]
|
|
|
|
type TrapLocationBySourceIDQuery = orm.ModQuery[*dialect.SelectQuery, trapLocationBySourceID, TrapLocationBySourceIDRow, []TrapLocationBySourceIDRow, trapLocationBySourceIDTransformer]
|
|
|
|
func TrapLocationBySourceID(OrganizationID int32, Globalid string) *TrapLocationBySourceIDQuery {
|
|
var expressionTypArgs trapLocationBySourceID
|
|
|
|
expressionTypArgs.OrganizationID = psql.Arg(OrganizationID)
|
|
expressionTypArgs.Globalid = psql.Arg(Globalid)
|
|
|
|
return &TrapLocationBySourceIDQuery{
|
|
Query: orm.Query[trapLocationBySourceID, TrapLocationBySourceIDRow, []TrapLocationBySourceIDRow, trapLocationBySourceIDTransformer]{
|
|
ExecQuery: orm.ExecQuery[trapLocationBySourceID]{
|
|
BaseQuery: bob.BaseQuery[trapLocationBySourceID]{
|
|
Expression: expressionTypArgs,
|
|
Dialect: dialect.Dialect,
|
|
QueryType: bob.QueryTypeSelect,
|
|
},
|
|
},
|
|
Scanner: func(context.Context, []string) (func(*scan.Row) (any, error), func(any) (TrapLocationBySourceIDRow, error)) {
|
|
return func(row *scan.Row) (any, error) {
|
|
var t TrapLocationBySourceIDRow
|
|
row.ScheduleScanByIndex(0, &t.TrapLocationGlobalid)
|
|
row.ScheduleScanByIndex(1, &t.Distance)
|
|
return &t, nil
|
|
}, func(v any) (TrapLocationBySourceIDRow, error) {
|
|
return *(v.(*TrapLocationBySourceIDRow)), nil
|
|
}
|
|
},
|
|
},
|
|
Mod: bob.ModFunc[*dialect.SelectQuery](func(q *dialect.SelectQuery) {
|
|
q.CombinedLimit.SetLimit(psql.Raw("4"))
|
|
q.AppendSelect(expressionTypArgs.subExpr(9, 90))
|
|
q.SetTable(expressionTypArgs.subExpr(98, 148))
|
|
q.AppendWhere(expressionTypArgs.subExpr(157, 202))
|
|
q.CombinedOrder.AppendOrder(expressionTypArgs.subExpr(214, 243))
|
|
}),
|
|
}
|
|
}
|
|
|
|
type TrapLocationBySourceIDRow = struct {
|
|
TrapLocationGlobalid string `db:"trap_location_globalid"`
|
|
Distance string `db:"distance"`
|
|
}
|
|
|
|
type trapLocationBySourceIDTransformer = bob.SliceTransformer[TrapLocationBySourceIDRow, []TrapLocationBySourceIDRow]
|
|
|
|
type trapLocationBySourceID struct {
|
|
OrganizationID bob.Expression
|
|
Globalid bob.Expression
|
|
}
|
|
|
|
func (o trapLocationBySourceID) args() iter.Seq[orm.ArgWithPosition] {
|
|
return func(yield func(arg orm.ArgWithPosition) bool) {
|
|
if !yield(orm.ArgWithPosition{
|
|
Name: "organizationID",
|
|
Start: 178,
|
|
Stop: 180,
|
|
Expression: o.OrganizationID,
|
|
}) {
|
|
return
|
|
}
|
|
|
|
if !yield(orm.ArgWithPosition{
|
|
Name: "globalid",
|
|
Start: 200,
|
|
Stop: 202,
|
|
Expression: o.Globalid,
|
|
}) {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
|
|
func (o trapLocationBySourceID) raw(from, to int) string {
|
|
return trapLocationBySourceIDSQL[from:to]
|
|
}
|
|
|
|
func (o trapLocationBySourceID) subExpr(from, to int) bob.Expression {
|
|
return orm.ArgsToExpression(trapLocationBySourceIDSQL, from, to, o.args())
|
|
}
|
|
|
|
func (o trapLocationBySourceID) WriteSQL(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
|
return o.subExpr(0, len(trapLocationBySourceIDSQL)).WriteSQL(ctx, w, d, start)
|
|
}
|