96 lines
2.8 KiB
Go
96 lines
2.8 KiB
Go
// Code generated by BobGen psql v0.0.4-0.20260105020634-53e08d840e47+dirty. 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/aarondl/opt/null"
|
|
"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 org_by_oauth_id.bob.sql
|
|
var formattedQueries_org_by_oauth_id string
|
|
|
|
var orgByOauthIdSQL = formattedQueries_org_by_oauth_id[185:398]
|
|
|
|
type OrgByOauthIdQuery = orm.ModQuery[*dialect.SelectQuery, orgByOauthId, OrgByOauthIdRow, []OrgByOauthIdRow, orgByOauthIdTransformer]
|
|
|
|
func OrgByOauthId(ID int32) *OrgByOauthIdQuery {
|
|
var expressionTypArgs orgByOauthId
|
|
|
|
expressionTypArgs.ID = psql.Arg(ID)
|
|
|
|
return &OrgByOauthIdQuery{
|
|
Query: orm.Query[orgByOauthId, OrgByOauthIdRow, []OrgByOauthIdRow, orgByOauthIdTransformer]{
|
|
ExecQuery: orm.ExecQuery[orgByOauthId]{
|
|
BaseQuery: bob.BaseQuery[orgByOauthId]{
|
|
Expression: expressionTypArgs,
|
|
Dialect: dialect.Dialect,
|
|
QueryType: bob.QueryTypeSelect,
|
|
},
|
|
},
|
|
Scanner: func(context.Context, []string) (func(*scan.Row) (any, error), func(any) (OrgByOauthIdRow, error)) {
|
|
return func(row *scan.Row) (any, error) {
|
|
var t OrgByOauthIdRow
|
|
row.ScheduleScanByIndex(0, &t.OrganizationID)
|
|
row.ScheduleScanByIndex(1, &t.ArcgisID)
|
|
row.ScheduleScanByIndex(2, &t.FieldseekerURL)
|
|
return &t, nil
|
|
}, func(v any) (OrgByOauthIdRow, error) {
|
|
return *(v.(*OrgByOauthIdRow)), nil
|
|
}
|
|
},
|
|
},
|
|
Mod: bob.ModFunc[*dialect.SelectQuery](func(q *dialect.SelectQuery) {
|
|
q.AppendSelect(expressionTypArgs.subExpr(7, 94))
|
|
q.SetTable(expressionTypArgs.subExpr(100, 196))
|
|
q.AppendWhere(expressionTypArgs.subExpr(203, 213))
|
|
}),
|
|
}
|
|
}
|
|
|
|
type OrgByOauthIdRow = struct {
|
|
OrganizationID int32 `db:"organization_id"`
|
|
ArcgisID null.Val[string] `db:"arcgis_id"`
|
|
FieldseekerURL null.Val[string] `db:"fieldseeker_url"`
|
|
}
|
|
|
|
type orgByOauthIdTransformer = bob.SliceTransformer[OrgByOauthIdRow, []OrgByOauthIdRow]
|
|
|
|
type orgByOauthId struct {
|
|
ID bob.Expression
|
|
}
|
|
|
|
func (o orgByOauthId) args() iter.Seq[orm.ArgWithPosition] {
|
|
return func(yield func(arg orm.ArgWithPosition) bool) {
|
|
if !yield(orm.ArgWithPosition{
|
|
Name: "id",
|
|
Start: 211,
|
|
Stop: 213,
|
|
Expression: o.ID,
|
|
}) {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
|
|
func (o orgByOauthId) raw(from, to int) string {
|
|
return orgByOauthIdSQL[from:to]
|
|
}
|
|
|
|
func (o orgByOauthId) subExpr(from, to int) bob.Expression {
|
|
return orm.ArgsToExpression(orgByOauthIdSQL, from, to, o.args())
|
|
}
|
|
|
|
func (o orgByOauthId) WriteSQL(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
|
return o.subExpr(0, len(orgByOauthIdSQL)).WriteSQL(ctx, w, d, start)
|
|
}
|