Properly record and display pool reports
This commit is contained in:
parent
47c3f7320c
commit
9328e7a2f8
15 changed files with 895 additions and 446 deletions
|
|
@ -4,7 +4,7 @@ SELECT
|
|||
"publicreport.image"."content_type" AS "content_type",
|
||||
"publicreport.image"."created" AS "created",
|
||||
"publicreport.image"."location" AS "location",
|
||||
ST_AsGeoJSON("publicreport.image"."location") AS "location_json",
|
||||
COALESCE(ST_AsGeoJSON("publicreport.image"."location"), '{}') AS "location_json",
|
||||
"publicreport.image"."resolution_x" AS "resolution_x",
|
||||
"publicreport.image"."resolution_y" AS "resolution_y",
|
||||
"publicreport.image"."storage_uuid" AS "storage_uuid",
|
||||
|
|
|
|||
112
db/sql/publicreport_image_with_json_by_pool_id.bob.go
Normal file
112
db/sql/publicreport_image_with_json_by_pool_id.bob.go
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
// 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"
|
||||
"time"
|
||||
|
||||
"github.com/Gleipnir-Technology/bob"
|
||||
"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/google/uuid"
|
||||
"github.com/stephenafamo/scan"
|
||||
)
|
||||
|
||||
//go:embed publicreport_image_with_json_by_pool_id.bob.sql
|
||||
var formattedQueries_publicreport_image_with_json_by_pool_id string
|
||||
|
||||
var publicreportImageWithJSONByPoolIDSQL = formattedQueries_publicreport_image_with_json_by_pool_id[171:975]
|
||||
|
||||
type PublicreportImageWithJSONByPoolIDQuery = orm.ModQuery[*dialect.SelectQuery, publicreportImageWithJSONByPoolID, PublicreportImageWithJSONByPoolIDRow, []PublicreportImageWithJSONByPoolIDRow, publicreportImageWithJSONByPoolIDTransformer]
|
||||
|
||||
func PublicreportImageWithJSONByPoolID(PoolID int32) *PublicreportImageWithJSONByPoolIDQuery {
|
||||
var expressionTypArgs publicreportImageWithJSONByPoolID
|
||||
|
||||
expressionTypArgs.PoolID = psql.Arg(PoolID)
|
||||
|
||||
return &PublicreportImageWithJSONByPoolIDQuery{
|
||||
Query: orm.Query[publicreportImageWithJSONByPoolID, PublicreportImageWithJSONByPoolIDRow, []PublicreportImageWithJSONByPoolIDRow, publicreportImageWithJSONByPoolIDTransformer]{
|
||||
ExecQuery: orm.ExecQuery[publicreportImageWithJSONByPoolID]{
|
||||
BaseQuery: bob.BaseQuery[publicreportImageWithJSONByPoolID]{
|
||||
Expression: expressionTypArgs,
|
||||
Dialect: dialect.Dialect,
|
||||
QueryType: bob.QueryTypeSelect,
|
||||
},
|
||||
},
|
||||
Scanner: func(context.Context, []string) (func(*scan.Row) (any, error), func(any) (PublicreportImageWithJSONByPoolIDRow, error)) {
|
||||
return func(row *scan.Row) (any, error) {
|
||||
var t PublicreportImageWithJSONByPoolIDRow
|
||||
row.ScheduleScanByIndex(0, &t.ID)
|
||||
row.ScheduleScanByIndex(1, &t.ContentType)
|
||||
row.ScheduleScanByIndex(2, &t.Created)
|
||||
row.ScheduleScanByIndex(3, &t.Location)
|
||||
row.ScheduleScanByIndex(4, &t.LocationJSON)
|
||||
row.ScheduleScanByIndex(5, &t.ResolutionX)
|
||||
row.ScheduleScanByIndex(6, &t.ResolutionY)
|
||||
row.ScheduleScanByIndex(7, &t.StorageUUID)
|
||||
row.ScheduleScanByIndex(8, &t.StorageSize)
|
||||
row.ScheduleScanByIndex(9, &t.UploadedFilename)
|
||||
return &t, nil
|
||||
}, func(v any) (PublicreportImageWithJSONByPoolIDRow, error) {
|
||||
return *(v.(*PublicreportImageWithJSONByPoolIDRow)), nil
|
||||
}
|
||||
},
|
||||
},
|
||||
Mod: bob.ModFunc[*dialect.SelectQuery](func(q *dialect.SelectQuery) {
|
||||
q.AppendSelect(expressionTypArgs.subExpr(9, 565))
|
||||
q.SetTable(expressionTypArgs.subExpr(571, 755))
|
||||
q.AppendWhere(expressionTypArgs.subExpr(763, 803))
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
type PublicreportImageWithJSONByPoolIDRow = struct {
|
||||
ID int32 `db:"id"`
|
||||
ContentType string `db:"content_type"`
|
||||
Created time.Time `db:"created"`
|
||||
Location null.Val[string] `db:"location"`
|
||||
LocationJSON string `db:"location_json"`
|
||||
ResolutionX int32 `db:"resolution_x"`
|
||||
ResolutionY int32 `db:"resolution_y"`
|
||||
StorageUUID uuid.UUID `db:"storage_uuid"`
|
||||
StorageSize int64 `db:"storage_size"`
|
||||
UploadedFilename string `db:"uploaded_filename"`
|
||||
}
|
||||
|
||||
type publicreportImageWithJSONByPoolIDTransformer = bob.SliceTransformer[PublicreportImageWithJSONByPoolIDRow, []PublicreportImageWithJSONByPoolIDRow]
|
||||
|
||||
type publicreportImageWithJSONByPoolID struct {
|
||||
PoolID bob.Expression
|
||||
}
|
||||
|
||||
func (o publicreportImageWithJSONByPoolID) args() iter.Seq[orm.ArgWithPosition] {
|
||||
return func(yield func(arg orm.ArgWithPosition) bool) {
|
||||
if !yield(orm.ArgWithPosition{
|
||||
Name: "poolID",
|
||||
Start: 801,
|
||||
Stop: 803,
|
||||
Expression: o.PoolID,
|
||||
}) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (o publicreportImageWithJSONByPoolID) raw(from, to int) string {
|
||||
return publicreportImageWithJSONByPoolIDSQL[from:to]
|
||||
}
|
||||
|
||||
func (o publicreportImageWithJSONByPoolID) subExpr(from, to int) bob.Expression {
|
||||
return orm.ArgsToExpression(publicreportImageWithJSONByPoolIDSQL, from, to, o.args())
|
||||
}
|
||||
|
||||
func (o publicreportImageWithJSONByPoolID) WriteSQL(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
||||
return o.subExpr(0, len(publicreportImageWithJSONByPoolIDSQL)).WriteSQL(ctx, w, d, start)
|
||||
}
|
||||
18
db/sql/publicreport_image_with_json_by_pool_id.bob.sql
Normal file
18
db/sql/publicreport_image_with_json_by_pool_id.bob.sql
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
-- 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.
|
||||
|
||||
-- PublicreportImageWithJSONByPoolID
|
||||
SELECT
|
||||
"publicreport.image"."id" AS "id",
|
||||
"publicreport.image"."content_type" AS "content_type",
|
||||
"publicreport.image"."created" AS "created",
|
||||
"publicreport.image"."location" AS "location",
|
||||
COALESCE(ST_AsGeoJSON("publicreport.image"."location"), '{}') AS "location_json",
|
||||
"publicreport.image"."resolution_x" AS "resolution_x",
|
||||
"publicreport.image"."resolution_y" AS "resolution_y",
|
||||
"publicreport.image"."storage_uuid" AS "storage_uuid",
|
||||
"publicreport.image"."storage_size" AS "storage_size",
|
||||
"publicreport.image"."uploaded_filename" AS "uploaded_filename"
|
||||
FROM "publicreport"."image" AS "publicreport.image"
|
||||
INNER JOIN "publicreport"."pool_image" AS "publicreport.pool_image" ON ("publicreport.image"."id" = "publicreport.pool_image"."image_id")
|
||||
WHERE ("publicreport.pool_image"."pool_id" = $1);
|
||||
15
db/sql/publicreport_image_with_json_by_pool_id.sql
Normal file
15
db/sql/publicreport_image_with_json_by_pool_id.sql
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
-- PublicreportImageWithJSONByPoolID
|
||||
SELECT
|
||||
"publicreport.image"."id" AS "id",
|
||||
"publicreport.image"."content_type" AS "content_type",
|
||||
"publicreport.image"."created" AS "created",
|
||||
"publicreport.image"."location" AS "location",
|
||||
COALESCE(ST_AsGeoJSON("publicreport.image"."location"), '{}') AS "location_json",
|
||||
"publicreport.image"."resolution_x" AS "resolution_x",
|
||||
"publicreport.image"."resolution_y" AS "resolution_y",
|
||||
"publicreport.image"."storage_uuid" AS "storage_uuid",
|
||||
"publicreport.image"."storage_size" AS "storage_size",
|
||||
"publicreport.image"."uploaded_filename" AS "uploaded_filename"
|
||||
FROM "publicreport"."image" AS "publicreport.image"
|
||||
INNER JOIN "publicreport"."pool_image" AS "publicreport.pool_image" ON ("publicreport.image"."id" = "publicreport.pool_image"."image_id")
|
||||
WHERE ("publicreport.pool_image"."pool_id" = $1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue