Add report ID suggestion to status page
This commit is contained in:
parent
7032f8e26b
commit
f3221ec315
6 changed files with 317 additions and 27 deletions
117
db/sql/publicreport_publicid_suggestion.bob.go
Normal file
117
db/sql/publicreport_publicid_suggestion.bob.go
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
// Code generated by BobGen psql v0.42.5. 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/Gleipnir-Technology/bob"
|
||||
"github.com/Gleipnir-Technology/bob/clause"
|
||||
"github.com/Gleipnir-Technology/bob/dialect/psql"
|
||||
"github.com/Gleipnir-Technology/bob/dialect/psql/dialect"
|
||||
"github.com/Gleipnir-Technology/bob/orm"
|
||||
"github.com/aarondl/opt/null"
|
||||
"github.com/stephenafamo/scan"
|
||||
)
|
||||
|
||||
//go:embed publicreport_publicid_suggestion.bob.sql
|
||||
var formattedQueries_publicreport_publicid_suggestion string
|
||||
|
||||
var publicreportPublicIDSuggestionSQL = formattedQueries_publicreport_publicid_suggestion[168:426]
|
||||
|
||||
type PublicreportPublicIDSuggestionQuery = orm.ModQuery[*dialect.SelectQuery, publicreportPublicIDSuggestion, PublicreportPublicIDSuggestionRow, []PublicreportPublicIDSuggestionRow, publicreportPublicIDSuggestionTransformer]
|
||||
|
||||
func PublicreportPublicIDSuggestion(Arg1 string) *PublicreportPublicIDSuggestionQuery {
|
||||
var expressionTypArgs publicreportPublicIDSuggestion
|
||||
|
||||
expressionTypArgs.Arg1 = psql.Arg(Arg1)
|
||||
|
||||
return &PublicreportPublicIDSuggestionQuery{
|
||||
Query: orm.Query[publicreportPublicIDSuggestion, PublicreportPublicIDSuggestionRow, []PublicreportPublicIDSuggestionRow, publicreportPublicIDSuggestionTransformer]{
|
||||
ExecQuery: orm.ExecQuery[publicreportPublicIDSuggestion]{
|
||||
BaseQuery: bob.BaseQuery[publicreportPublicIDSuggestion]{
|
||||
Expression: expressionTypArgs,
|
||||
Dialect: dialect.Dialect,
|
||||
QueryType: bob.QueryTypeSelect,
|
||||
},
|
||||
},
|
||||
Scanner: func(context.Context, []string) (func(*scan.Row) (any, error), func(any) (PublicreportPublicIDSuggestionRow, error)) {
|
||||
return func(row *scan.Row) (any, error) {
|
||||
var t PublicreportPublicIDSuggestionRow
|
||||
row.ScheduleScanByIndex(0, &t.TableName)
|
||||
row.ScheduleScanByIndex(1, &t.PublicID)
|
||||
row.ScheduleScanByIndex(2, &t.Location)
|
||||
return &t, nil
|
||||
}, func(v any) (PublicreportPublicIDSuggestionRow, error) {
|
||||
return *(v.(*PublicreportPublicIDSuggestionRow)), nil
|
||||
}
|
||||
},
|
||||
},
|
||||
Mod: bob.ModFunc[*dialect.SelectQuery](func(q *dialect.SelectQuery) {
|
||||
q.AppendSelect(expressionTypArgs.subExpr(10, 59))
|
||||
q.SetTable(expressionTypArgs.subExpr(68, 89))
|
||||
q.AppendWhere(expressionTypArgs.subExpr(99, 116))
|
||||
|
||||
q.AppendCombine(clause.Combine{
|
||||
Strategy: "UNION",
|
||||
All: true,
|
||||
Query: bob.BaseQuery[bob.Expression]{
|
||||
Expression: expressionTypArgs.subExpr(129, 237),
|
||||
QueryType: bob.QueryTypeSelect,
|
||||
Dialect: dialect.Dialect,
|
||||
},
|
||||
})
|
||||
q.CombinedOrder.AppendOrder(expressionTypArgs.subExpr(249, 258))
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
type PublicreportPublicIDSuggestionRow = struct {
|
||||
TableName string `db:"table_name"`
|
||||
PublicID string `db:"public_id"`
|
||||
Location null.Val[string] `db:"location"`
|
||||
}
|
||||
|
||||
type publicreportPublicIDSuggestionTransformer = bob.SliceTransformer[PublicreportPublicIDSuggestionRow, []PublicreportPublicIDSuggestionRow]
|
||||
|
||||
type publicreportPublicIDSuggestion struct {
|
||||
Arg1 bob.Expression
|
||||
}
|
||||
|
||||
func (o publicreportPublicIDSuggestion) args() iter.Seq[orm.ArgWithPosition] {
|
||||
return func(yield func(arg orm.ArgWithPosition) bool) {
|
||||
if !yield(orm.ArgWithPosition{
|
||||
Name: "arg1",
|
||||
Start: 114,
|
||||
Stop: 116,
|
||||
Expression: o.Arg1,
|
||||
}) {
|
||||
return
|
||||
}
|
||||
|
||||
if !yield(orm.ArgWithPosition{
|
||||
Name: "arg1",
|
||||
Start: 235,
|
||||
Stop: 237,
|
||||
Expression: o.Arg1,
|
||||
}) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (o publicreportPublicIDSuggestion) raw(from, to int) string {
|
||||
return publicreportPublicIDSuggestionSQL[from:to]
|
||||
}
|
||||
|
||||
func (o publicreportPublicIDSuggestion) subExpr(from, to int) bob.Expression {
|
||||
return orm.ArgsToExpression(publicreportPublicIDSuggestionSQL, from, to, o.args())
|
||||
}
|
||||
|
||||
func (o publicreportPublicIDSuggestion) WriteSQL(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
||||
return o.subExpr(0, len(publicreportPublicIDSuggestionSQL)).WriteSQL(ctx, w, d, start)
|
||||
}
|
||||
25
db/sql/publicreport_publicid_suggestion.bob.sql
Normal file
25
db/sql/publicreport_publicid_suggestion.bob.sql
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
-- Code generated by BobGen psql v0.42.5. DO NOT EDIT.
|
||||
-- This file is meant to be re-generated in place and/or deleted at any time.
|
||||
|
||||
-- PublicreportPublicIDSuggestion
|
||||
SELECT
|
||||
'nuisance' AS table_name,
|
||||
public_id,
|
||||
location
|
||||
FROM
|
||||
publicreport.nuisance
|
||||
WHERE
|
||||
public_id LIKE $1
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
'pool' AS table_name,
|
||||
public_id,
|
||||
location
|
||||
FROM
|
||||
publicreport.pool
|
||||
WHERE
|
||||
public_id LIKE $2
|
||||
ORDER BY
|
||||
public_id;
|
||||
22
db/sql/publicreport_publicid_suggestion.sql
Normal file
22
db/sql/publicreport_publicid_suggestion.sql
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
-- PublicreportPublicIDSuggestion
|
||||
SELECT
|
||||
'nuisance' AS table_name,
|
||||
public_id,
|
||||
location
|
||||
FROM
|
||||
publicreport.nuisance
|
||||
WHERE
|
||||
public_id LIKE $1
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
'pool' AS table_name,
|
||||
public_id,
|
||||
location
|
||||
FROM
|
||||
publicreport.pool
|
||||
WHERE
|
||||
public_id LIKE $1
|
||||
ORDER BY
|
||||
public_id;
|
||||
Loading…
Add table
Add a link
Reference in a new issue