nidus-sync/db/sql/update_oauth_org.bob.go
Eli Ribble 1395e3d3ac 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.
2025-12-24 17:58:08 -07:00

95 lines
2.6 KiB
Go

// 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
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"
)
//go:embed update_oauth_org.bob.sql
var formattedQueries_update_oauth_org string
var updateOauthTokenOrgSQL = formattedQueries_update_oauth_org[192:284]
type UpdateOauthTokenOrgQuery = orm.ModExecQuery[*dialect.UpdateQuery, updateOauthTokenOrg]
func UpdateOauthTokenOrg(ArcgisID string, ArcgisLicenseTypeID string, RefreshToken string) *UpdateOauthTokenOrgQuery {
var expressionTypArgs updateOauthTokenOrg
expressionTypArgs.ArcgisID = psql.Arg(ArcgisID)
expressionTypArgs.ArcgisLicenseTypeID = psql.Arg(ArcgisLicenseTypeID)
expressionTypArgs.RefreshToken = psql.Arg(RefreshToken)
return &UpdateOauthTokenOrgQuery{
ExecQuery: orm.ExecQuery[updateOauthTokenOrg]{
BaseQuery: bob.BaseQuery[updateOauthTokenOrg]{
Expression: expressionTypArgs,
Dialect: dialect.Dialect,
QueryType: bob.QueryTypeUpdate,
},
},
Mod: bob.ModFunc[*dialect.UpdateQuery](func(q *dialect.UpdateQuery) {
q.Table.Expression = expressionTypArgs.subExpr(7, 18)
q.AppendSet(expressionTypArgs.subExpr(23, 66))
q.AppendWhere(expressionTypArgs.subExpr(74, 92))
}),
}
}
type updateOauthTokenOrg struct {
ArcgisID bob.Expression
ArcgisLicenseTypeID bob.Expression
RefreshToken bob.Expression
}
func (o updateOauthTokenOrg) args() iter.Seq[orm.ArgWithPosition] {
return func(yield func(arg orm.ArgWithPosition) bool) {
if !yield(orm.ArgWithPosition{
Name: "arcgisID",
Start: 35,
Stop: 37,
Expression: o.ArcgisID,
}) {
return
}
if !yield(orm.ArgWithPosition{
Name: "arcgisLicenseTypeID",
Start: 64,
Stop: 66,
Expression: o.ArcgisLicenseTypeID,
}) {
return
}
if !yield(orm.ArgWithPosition{
Name: "refreshToken",
Start: 90,
Stop: 92,
Expression: o.RefreshToken,
}) {
return
}
}
}
func (o updateOauthTokenOrg) raw(from, to int) string {
return updateOauthTokenOrgSQL[from:to]
}
func (o updateOauthTokenOrg) subExpr(from, to int) bob.Expression {
return orm.ArgsToExpression(updateOauthTokenOrgSQL, from, to, o.args())
}
func (o updateOauthTokenOrg) WriteSQL(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
return o.subExpr(0, len(updateOauthTokenOrgSQL)).WriteSQL(ctx, w, d, start)
}