2026-01-27 18:44:02 +00:00
|
|
|
// Code generated by BobGen psql v0.42.5. DO NOT EDIT.
|
2026-01-09 19:43:19 +00:00
|
|
|
// This file is meant to be re-generated in place and/or deleted at any time.
|
|
|
|
|
|
|
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"fmt"
|
|
|
|
|
"io"
|
|
|
|
|
"time"
|
|
|
|
|
|
2026-01-27 18:44:02 +00:00
|
|
|
"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/dialect/psql/dm"
|
|
|
|
|
"github.com/Gleipnir-Technology/bob/dialect/psql/sm"
|
|
|
|
|
"github.com/Gleipnir-Technology/bob/dialect/psql/um"
|
|
|
|
|
"github.com/Gleipnir-Technology/bob/expr"
|
|
|
|
|
"github.com/Gleipnir-Technology/bob/orm"
|
|
|
|
|
"github.com/Gleipnir-Technology/bob/types/pgtypes"
|
2026-01-13 19:47:19 +00:00
|
|
|
enums "github.com/Gleipnir-Technology/nidus-sync/db/enums"
|
2026-01-09 19:43:19 +00:00
|
|
|
"github.com/aarondl/opt/null"
|
|
|
|
|
"github.com/aarondl/opt/omit"
|
|
|
|
|
"github.com/aarondl/opt/omitnull"
|
2026-01-16 14:52:11 +00:00
|
|
|
"github.com/stephenafamo/scan"
|
2026-01-09 19:43:19 +00:00
|
|
|
)
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// PublicreportWater is an object representing the database table.
|
|
|
|
|
type PublicreportWater struct {
|
2026-02-05 21:43:29 +00:00
|
|
|
ID int32 `db:"id,pk" `
|
|
|
|
|
AccessComments string `db:"access_comments" `
|
|
|
|
|
AccessGate bool `db:"access_gate" `
|
|
|
|
|
AccessFence bool `db:"access_fence" `
|
|
|
|
|
AccessLocked bool `db:"access_locked" `
|
|
|
|
|
AccessDog bool `db:"access_dog" `
|
|
|
|
|
AccessOther bool `db:"access_other" `
|
2026-03-09 18:02:22 +00:00
|
|
|
AddressRaw string `db:"address_raw" `
|
2026-02-05 21:43:29 +00:00
|
|
|
AddressCountry string `db:"address_country" `
|
2026-03-09 18:02:22 +00:00
|
|
|
AddressPostalCode string `db:"address_postal_code" `
|
|
|
|
|
AddressLocality string `db:"address_locality" `
|
2026-02-05 21:43:29 +00:00
|
|
|
AddressStreet string `db:"address_street" `
|
|
|
|
|
AddressRegion string `db:"address_region" `
|
|
|
|
|
Comments string `db:"comments" `
|
|
|
|
|
Created time.Time `db:"created" `
|
|
|
|
|
H3cell null.Val[string] `db:"h3cell" `
|
|
|
|
|
HasAdult bool `db:"has_adult" `
|
|
|
|
|
HasLarvae bool `db:"has_larvae" `
|
|
|
|
|
HasPupae bool `db:"has_pupae" `
|
|
|
|
|
MapZoom float32 `db:"map_zoom" `
|
|
|
|
|
OwnerEmail string `db:"owner_email" `
|
|
|
|
|
OwnerName string `db:"owner_name" `
|
|
|
|
|
OwnerPhone string `db:"owner_phone" `
|
|
|
|
|
PublicID string `db:"public_id" `
|
|
|
|
|
ReporterEmail string `db:"reporter_email" `
|
|
|
|
|
ReporterName string `db:"reporter_name" `
|
|
|
|
|
ReporterPhone string `db:"reporter_phone" `
|
|
|
|
|
Status enums.PublicreportReportstatustype `db:"status" `
|
|
|
|
|
OrganizationID null.Val[int32] `db:"organization_id" `
|
|
|
|
|
HasBackyardPermission bool `db:"has_backyard_permission" `
|
|
|
|
|
IsReporterConfidential bool `db:"is_reporter_confidential" `
|
|
|
|
|
IsReporterOwner bool `db:"is_reporter_owner" `
|
2026-02-06 15:39:49 +00:00
|
|
|
ReporterContactConsent null.Val[bool] `db:"reporter_contact_consent" `
|
2026-03-08 02:43:00 +00:00
|
|
|
Location null.Val[string] `db:"location" `
|
2026-03-08 03:14:38 +00:00
|
|
|
AddressNumber string `db:"address_number" `
|
2026-03-09 18:02:22 +00:00
|
|
|
AddressID null.Val[int32] `db:"address_id" `
|
2026-01-09 19:43:19 +00:00
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
R publicreportWaterR `db:"-" `
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// PublicreportWaterSlice is an alias for a slice of pointers to PublicreportWater.
|
|
|
|
|
// This should almost always be used instead of []*PublicreportWater.
|
|
|
|
|
type PublicreportWaterSlice []*PublicreportWater
|
2026-01-09 19:43:19 +00:00
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// PublicreportWaters contains methods to work with the water table
|
|
|
|
|
var PublicreportWaters = psql.NewTablex[*PublicreportWater, PublicreportWaterSlice, *PublicreportWaterSetter]("publicreport", "water", buildPublicreportWaterColumns("publicreport.water"))
|
2026-01-09 19:43:19 +00:00
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// PublicreportWatersQuery is a query on the water table
|
|
|
|
|
type PublicreportWatersQuery = *psql.ViewQuery[*PublicreportWater, PublicreportWaterSlice]
|
2026-01-09 19:43:19 +00:00
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// publicreportWaterR is where relationships are stored.
|
|
|
|
|
type publicreportWaterR struct {
|
|
|
|
|
NotifyEmailWaters PublicreportNotifyEmailWaterSlice // publicreport.notify_email_water.notify_email_pool_pool_id_fkey
|
|
|
|
|
NotifyPhoneWaters PublicreportNotifyPhoneWaterSlice // publicreport.notify_phone_water.notify_phone_pool_pool_id_fkey
|
|
|
|
|
Address *Address // publicreport.water.pool_address_id_fkey
|
|
|
|
|
Organization *Organization // publicreport.water.pool_organization_id_fkey
|
|
|
|
|
Images PublicreportImageSlice // publicreport.water_image.pool_image_image_id_fkeypublicreport.water_image.pool_image_pool_id_fkey
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func buildPublicreportWaterColumns(alias string) publicreportWaterColumns {
|
|
|
|
|
return publicreportWaterColumns{
|
2026-01-09 19:43:19 +00:00
|
|
|
ColumnsExpr: expr.NewColumnsExpr(
|
2026-03-09 18:02:22 +00:00
|
|
|
"id", "access_comments", "access_gate", "access_fence", "access_locked", "access_dog", "access_other", "address_raw", "address_country", "address_postal_code", "address_locality", "address_street", "address_region", "comments", "created", "h3cell", "has_adult", "has_larvae", "has_pupae", "map_zoom", "owner_email", "owner_name", "owner_phone", "public_id", "reporter_email", "reporter_name", "reporter_phone", "status", "organization_id", "has_backyard_permission", "is_reporter_confidential", "is_reporter_owner", "reporter_contact_consent", "location", "address_number", "address_id",
|
|
|
|
|
).WithParent("publicreport.water"),
|
2026-02-05 21:43:29 +00:00
|
|
|
tableAlias: alias,
|
|
|
|
|
ID: psql.Quote(alias, "id"),
|
|
|
|
|
AccessComments: psql.Quote(alias, "access_comments"),
|
|
|
|
|
AccessGate: psql.Quote(alias, "access_gate"),
|
|
|
|
|
AccessFence: psql.Quote(alias, "access_fence"),
|
|
|
|
|
AccessLocked: psql.Quote(alias, "access_locked"),
|
|
|
|
|
AccessDog: psql.Quote(alias, "access_dog"),
|
|
|
|
|
AccessOther: psql.Quote(alias, "access_other"),
|
2026-03-09 18:02:22 +00:00
|
|
|
AddressRaw: psql.Quote(alias, "address_raw"),
|
2026-02-05 21:43:29 +00:00
|
|
|
AddressCountry: psql.Quote(alias, "address_country"),
|
2026-03-09 18:02:22 +00:00
|
|
|
AddressPostalCode: psql.Quote(alias, "address_postal_code"),
|
|
|
|
|
AddressLocality: psql.Quote(alias, "address_locality"),
|
2026-02-05 21:43:29 +00:00
|
|
|
AddressStreet: psql.Quote(alias, "address_street"),
|
|
|
|
|
AddressRegion: psql.Quote(alias, "address_region"),
|
|
|
|
|
Comments: psql.Quote(alias, "comments"),
|
|
|
|
|
Created: psql.Quote(alias, "created"),
|
|
|
|
|
H3cell: psql.Quote(alias, "h3cell"),
|
|
|
|
|
HasAdult: psql.Quote(alias, "has_adult"),
|
|
|
|
|
HasLarvae: psql.Quote(alias, "has_larvae"),
|
|
|
|
|
HasPupae: psql.Quote(alias, "has_pupae"),
|
|
|
|
|
MapZoom: psql.Quote(alias, "map_zoom"),
|
|
|
|
|
OwnerEmail: psql.Quote(alias, "owner_email"),
|
|
|
|
|
OwnerName: psql.Quote(alias, "owner_name"),
|
|
|
|
|
OwnerPhone: psql.Quote(alias, "owner_phone"),
|
|
|
|
|
PublicID: psql.Quote(alias, "public_id"),
|
|
|
|
|
ReporterEmail: psql.Quote(alias, "reporter_email"),
|
|
|
|
|
ReporterName: psql.Quote(alias, "reporter_name"),
|
|
|
|
|
ReporterPhone: psql.Quote(alias, "reporter_phone"),
|
|
|
|
|
Status: psql.Quote(alias, "status"),
|
|
|
|
|
OrganizationID: psql.Quote(alias, "organization_id"),
|
|
|
|
|
HasBackyardPermission: psql.Quote(alias, "has_backyard_permission"),
|
|
|
|
|
IsReporterConfidential: psql.Quote(alias, "is_reporter_confidential"),
|
|
|
|
|
IsReporterOwner: psql.Quote(alias, "is_reporter_owner"),
|
2026-02-06 15:39:49 +00:00
|
|
|
ReporterContactConsent: psql.Quote(alias, "reporter_contact_consent"),
|
2026-03-08 02:43:00 +00:00
|
|
|
Location: psql.Quote(alias, "location"),
|
2026-03-08 03:14:38 +00:00
|
|
|
AddressNumber: psql.Quote(alias, "address_number"),
|
2026-03-09 18:02:22 +00:00
|
|
|
AddressID: psql.Quote(alias, "address_id"),
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
type publicreportWaterColumns struct {
|
2026-01-09 19:43:19 +00:00
|
|
|
expr.ColumnsExpr
|
2026-02-05 21:43:29 +00:00
|
|
|
tableAlias string
|
|
|
|
|
ID psql.Expression
|
|
|
|
|
AccessComments psql.Expression
|
|
|
|
|
AccessGate psql.Expression
|
|
|
|
|
AccessFence psql.Expression
|
|
|
|
|
AccessLocked psql.Expression
|
|
|
|
|
AccessDog psql.Expression
|
|
|
|
|
AccessOther psql.Expression
|
2026-03-09 18:02:22 +00:00
|
|
|
AddressRaw psql.Expression
|
2026-02-05 21:43:29 +00:00
|
|
|
AddressCountry psql.Expression
|
2026-03-09 18:02:22 +00:00
|
|
|
AddressPostalCode psql.Expression
|
|
|
|
|
AddressLocality psql.Expression
|
2026-02-05 21:43:29 +00:00
|
|
|
AddressStreet psql.Expression
|
|
|
|
|
AddressRegion psql.Expression
|
|
|
|
|
Comments psql.Expression
|
|
|
|
|
Created psql.Expression
|
|
|
|
|
H3cell psql.Expression
|
|
|
|
|
HasAdult psql.Expression
|
|
|
|
|
HasLarvae psql.Expression
|
|
|
|
|
HasPupae psql.Expression
|
|
|
|
|
MapZoom psql.Expression
|
|
|
|
|
OwnerEmail psql.Expression
|
|
|
|
|
OwnerName psql.Expression
|
|
|
|
|
OwnerPhone psql.Expression
|
|
|
|
|
PublicID psql.Expression
|
|
|
|
|
ReporterEmail psql.Expression
|
|
|
|
|
ReporterName psql.Expression
|
|
|
|
|
ReporterPhone psql.Expression
|
|
|
|
|
Status psql.Expression
|
|
|
|
|
OrganizationID psql.Expression
|
|
|
|
|
HasBackyardPermission psql.Expression
|
|
|
|
|
IsReporterConfidential psql.Expression
|
|
|
|
|
IsReporterOwner psql.Expression
|
2026-02-06 15:39:49 +00:00
|
|
|
ReporterContactConsent psql.Expression
|
2026-03-08 02:43:00 +00:00
|
|
|
Location psql.Expression
|
2026-03-08 03:14:38 +00:00
|
|
|
AddressNumber psql.Expression
|
2026-03-09 18:02:22 +00:00
|
|
|
AddressID psql.Expression
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (c publicreportWaterColumns) Alias() string {
|
2026-01-09 19:43:19 +00:00
|
|
|
return c.tableAlias
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (publicreportWaterColumns) AliasedAs(alias string) publicreportWaterColumns {
|
|
|
|
|
return buildPublicreportWaterColumns(alias)
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// PublicreportWaterSetter is used for insert/upsert/update operations
|
2026-01-09 19:43:19 +00:00
|
|
|
// All values are optional, and do not have to be set
|
|
|
|
|
// Generated columns are not included
|
2026-03-09 18:02:22 +00:00
|
|
|
type PublicreportWaterSetter struct {
|
2026-02-05 21:43:29 +00:00
|
|
|
ID omit.Val[int32] `db:"id,pk" `
|
|
|
|
|
AccessComments omit.Val[string] `db:"access_comments" `
|
|
|
|
|
AccessGate omit.Val[bool] `db:"access_gate" `
|
|
|
|
|
AccessFence omit.Val[bool] `db:"access_fence" `
|
|
|
|
|
AccessLocked omit.Val[bool] `db:"access_locked" `
|
|
|
|
|
AccessDog omit.Val[bool] `db:"access_dog" `
|
|
|
|
|
AccessOther omit.Val[bool] `db:"access_other" `
|
2026-03-09 18:02:22 +00:00
|
|
|
AddressRaw omit.Val[string] `db:"address_raw" `
|
2026-02-05 21:43:29 +00:00
|
|
|
AddressCountry omit.Val[string] `db:"address_country" `
|
2026-03-09 18:02:22 +00:00
|
|
|
AddressPostalCode omit.Val[string] `db:"address_postal_code" `
|
|
|
|
|
AddressLocality omit.Val[string] `db:"address_locality" `
|
2026-02-05 21:43:29 +00:00
|
|
|
AddressStreet omit.Val[string] `db:"address_street" `
|
|
|
|
|
AddressRegion omit.Val[string] `db:"address_region" `
|
|
|
|
|
Comments omit.Val[string] `db:"comments" `
|
|
|
|
|
Created omit.Val[time.Time] `db:"created" `
|
|
|
|
|
H3cell omitnull.Val[string] `db:"h3cell" `
|
|
|
|
|
HasAdult omit.Val[bool] `db:"has_adult" `
|
|
|
|
|
HasLarvae omit.Val[bool] `db:"has_larvae" `
|
|
|
|
|
HasPupae omit.Val[bool] `db:"has_pupae" `
|
|
|
|
|
MapZoom omit.Val[float32] `db:"map_zoom" `
|
|
|
|
|
OwnerEmail omit.Val[string] `db:"owner_email" `
|
|
|
|
|
OwnerName omit.Val[string] `db:"owner_name" `
|
|
|
|
|
OwnerPhone omit.Val[string] `db:"owner_phone" `
|
|
|
|
|
PublicID omit.Val[string] `db:"public_id" `
|
|
|
|
|
ReporterEmail omit.Val[string] `db:"reporter_email" `
|
|
|
|
|
ReporterName omit.Val[string] `db:"reporter_name" `
|
|
|
|
|
ReporterPhone omit.Val[string] `db:"reporter_phone" `
|
|
|
|
|
Status omit.Val[enums.PublicreportReportstatustype] `db:"status" `
|
|
|
|
|
OrganizationID omitnull.Val[int32] `db:"organization_id" `
|
|
|
|
|
HasBackyardPermission omit.Val[bool] `db:"has_backyard_permission" `
|
|
|
|
|
IsReporterConfidential omit.Val[bool] `db:"is_reporter_confidential" `
|
|
|
|
|
IsReporterOwner omit.Val[bool] `db:"is_reporter_owner" `
|
2026-02-06 15:39:49 +00:00
|
|
|
ReporterContactConsent omitnull.Val[bool] `db:"reporter_contact_consent" `
|
2026-03-08 02:43:00 +00:00
|
|
|
Location omitnull.Val[string] `db:"location" `
|
2026-03-08 03:14:38 +00:00
|
|
|
AddressNumber omit.Val[string] `db:"address_number" `
|
2026-03-09 18:02:22 +00:00
|
|
|
AddressID omitnull.Val[int32] `db:"address_id" `
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (s PublicreportWaterSetter) SetColumns() []string {
|
|
|
|
|
vals := make([]string, 0, 36)
|
2026-01-09 19:43:19 +00:00
|
|
|
if s.ID.IsValue() {
|
|
|
|
|
vals = append(vals, "id")
|
|
|
|
|
}
|
|
|
|
|
if s.AccessComments.IsValue() {
|
|
|
|
|
vals = append(vals, "access_comments")
|
|
|
|
|
}
|
|
|
|
|
if s.AccessGate.IsValue() {
|
|
|
|
|
vals = append(vals, "access_gate")
|
|
|
|
|
}
|
|
|
|
|
if s.AccessFence.IsValue() {
|
|
|
|
|
vals = append(vals, "access_fence")
|
|
|
|
|
}
|
|
|
|
|
if s.AccessLocked.IsValue() {
|
|
|
|
|
vals = append(vals, "access_locked")
|
|
|
|
|
}
|
|
|
|
|
if s.AccessDog.IsValue() {
|
|
|
|
|
vals = append(vals, "access_dog")
|
|
|
|
|
}
|
|
|
|
|
if s.AccessOther.IsValue() {
|
|
|
|
|
vals = append(vals, "access_other")
|
|
|
|
|
}
|
2026-03-09 18:02:22 +00:00
|
|
|
if s.AddressRaw.IsValue() {
|
|
|
|
|
vals = append(vals, "address_raw")
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
if s.AddressCountry.IsValue() {
|
|
|
|
|
vals = append(vals, "address_country")
|
|
|
|
|
}
|
2026-03-09 18:02:22 +00:00
|
|
|
if s.AddressPostalCode.IsValue() {
|
|
|
|
|
vals = append(vals, "address_postal_code")
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
2026-03-09 18:02:22 +00:00
|
|
|
if s.AddressLocality.IsValue() {
|
|
|
|
|
vals = append(vals, "address_locality")
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
if s.AddressStreet.IsValue() {
|
|
|
|
|
vals = append(vals, "address_street")
|
|
|
|
|
}
|
|
|
|
|
if s.AddressRegion.IsValue() {
|
|
|
|
|
vals = append(vals, "address_region")
|
|
|
|
|
}
|
|
|
|
|
if s.Comments.IsValue() {
|
|
|
|
|
vals = append(vals, "comments")
|
|
|
|
|
}
|
|
|
|
|
if s.Created.IsValue() {
|
|
|
|
|
vals = append(vals, "created")
|
|
|
|
|
}
|
|
|
|
|
if !s.H3cell.IsUnset() {
|
|
|
|
|
vals = append(vals, "h3cell")
|
|
|
|
|
}
|
|
|
|
|
if s.HasAdult.IsValue() {
|
|
|
|
|
vals = append(vals, "has_adult")
|
|
|
|
|
}
|
|
|
|
|
if s.HasLarvae.IsValue() {
|
|
|
|
|
vals = append(vals, "has_larvae")
|
|
|
|
|
}
|
|
|
|
|
if s.HasPupae.IsValue() {
|
|
|
|
|
vals = append(vals, "has_pupae")
|
|
|
|
|
}
|
|
|
|
|
if s.MapZoom.IsValue() {
|
|
|
|
|
vals = append(vals, "map_zoom")
|
|
|
|
|
}
|
|
|
|
|
if s.OwnerEmail.IsValue() {
|
|
|
|
|
vals = append(vals, "owner_email")
|
|
|
|
|
}
|
|
|
|
|
if s.OwnerName.IsValue() {
|
|
|
|
|
vals = append(vals, "owner_name")
|
|
|
|
|
}
|
|
|
|
|
if s.OwnerPhone.IsValue() {
|
|
|
|
|
vals = append(vals, "owner_phone")
|
|
|
|
|
}
|
|
|
|
|
if s.PublicID.IsValue() {
|
|
|
|
|
vals = append(vals, "public_id")
|
|
|
|
|
}
|
|
|
|
|
if s.ReporterEmail.IsValue() {
|
|
|
|
|
vals = append(vals, "reporter_email")
|
|
|
|
|
}
|
|
|
|
|
if s.ReporterName.IsValue() {
|
|
|
|
|
vals = append(vals, "reporter_name")
|
|
|
|
|
}
|
|
|
|
|
if s.ReporterPhone.IsValue() {
|
|
|
|
|
vals = append(vals, "reporter_phone")
|
|
|
|
|
}
|
2026-01-13 19:47:19 +00:00
|
|
|
if s.Status.IsValue() {
|
|
|
|
|
vals = append(vals, "status")
|
|
|
|
|
}
|
2026-01-22 03:27:32 +00:00
|
|
|
if !s.OrganizationID.IsUnset() {
|
|
|
|
|
vals = append(vals, "organization_id")
|
|
|
|
|
}
|
2026-02-05 21:43:29 +00:00
|
|
|
if s.HasBackyardPermission.IsValue() {
|
|
|
|
|
vals = append(vals, "has_backyard_permission")
|
|
|
|
|
}
|
|
|
|
|
if s.IsReporterConfidential.IsValue() {
|
|
|
|
|
vals = append(vals, "is_reporter_confidential")
|
|
|
|
|
}
|
|
|
|
|
if s.IsReporterOwner.IsValue() {
|
|
|
|
|
vals = append(vals, "is_reporter_owner")
|
|
|
|
|
}
|
2026-02-06 15:39:49 +00:00
|
|
|
if !s.ReporterContactConsent.IsUnset() {
|
|
|
|
|
vals = append(vals, "reporter_contact_consent")
|
|
|
|
|
}
|
2026-03-08 02:43:00 +00:00
|
|
|
if !s.Location.IsUnset() {
|
|
|
|
|
vals = append(vals, "location")
|
|
|
|
|
}
|
2026-03-08 03:14:38 +00:00
|
|
|
if s.AddressNumber.IsValue() {
|
|
|
|
|
vals = append(vals, "address_number")
|
|
|
|
|
}
|
2026-03-09 18:02:22 +00:00
|
|
|
if !s.AddressID.IsUnset() {
|
|
|
|
|
vals = append(vals, "address_id")
|
|
|
|
|
}
|
2026-01-09 19:43:19 +00:00
|
|
|
return vals
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (s PublicreportWaterSetter) Overwrite(t *PublicreportWater) {
|
2026-01-09 19:43:19 +00:00
|
|
|
if s.ID.IsValue() {
|
|
|
|
|
t.ID = s.ID.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.AccessComments.IsValue() {
|
|
|
|
|
t.AccessComments = s.AccessComments.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.AccessGate.IsValue() {
|
|
|
|
|
t.AccessGate = s.AccessGate.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.AccessFence.IsValue() {
|
|
|
|
|
t.AccessFence = s.AccessFence.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.AccessLocked.IsValue() {
|
|
|
|
|
t.AccessLocked = s.AccessLocked.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.AccessDog.IsValue() {
|
|
|
|
|
t.AccessDog = s.AccessDog.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.AccessOther.IsValue() {
|
|
|
|
|
t.AccessOther = s.AccessOther.MustGet()
|
|
|
|
|
}
|
2026-03-09 18:02:22 +00:00
|
|
|
if s.AddressRaw.IsValue() {
|
|
|
|
|
t.AddressRaw = s.AddressRaw.MustGet()
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
if s.AddressCountry.IsValue() {
|
|
|
|
|
t.AddressCountry = s.AddressCountry.MustGet()
|
|
|
|
|
}
|
2026-03-09 18:02:22 +00:00
|
|
|
if s.AddressPostalCode.IsValue() {
|
|
|
|
|
t.AddressPostalCode = s.AddressPostalCode.MustGet()
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
2026-03-09 18:02:22 +00:00
|
|
|
if s.AddressLocality.IsValue() {
|
|
|
|
|
t.AddressLocality = s.AddressLocality.MustGet()
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
if s.AddressStreet.IsValue() {
|
|
|
|
|
t.AddressStreet = s.AddressStreet.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.AddressRegion.IsValue() {
|
|
|
|
|
t.AddressRegion = s.AddressRegion.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.Comments.IsValue() {
|
|
|
|
|
t.Comments = s.Comments.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.Created.IsValue() {
|
|
|
|
|
t.Created = s.Created.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if !s.H3cell.IsUnset() {
|
|
|
|
|
t.H3cell = s.H3cell.MustGetNull()
|
|
|
|
|
}
|
|
|
|
|
if s.HasAdult.IsValue() {
|
|
|
|
|
t.HasAdult = s.HasAdult.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.HasLarvae.IsValue() {
|
|
|
|
|
t.HasLarvae = s.HasLarvae.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.HasPupae.IsValue() {
|
|
|
|
|
t.HasPupae = s.HasPupae.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.MapZoom.IsValue() {
|
|
|
|
|
t.MapZoom = s.MapZoom.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.OwnerEmail.IsValue() {
|
|
|
|
|
t.OwnerEmail = s.OwnerEmail.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.OwnerName.IsValue() {
|
|
|
|
|
t.OwnerName = s.OwnerName.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.OwnerPhone.IsValue() {
|
|
|
|
|
t.OwnerPhone = s.OwnerPhone.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.PublicID.IsValue() {
|
|
|
|
|
t.PublicID = s.PublicID.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.ReporterEmail.IsValue() {
|
|
|
|
|
t.ReporterEmail = s.ReporterEmail.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.ReporterName.IsValue() {
|
|
|
|
|
t.ReporterName = s.ReporterName.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.ReporterPhone.IsValue() {
|
|
|
|
|
t.ReporterPhone = s.ReporterPhone.MustGet()
|
|
|
|
|
}
|
2026-01-13 19:47:19 +00:00
|
|
|
if s.Status.IsValue() {
|
|
|
|
|
t.Status = s.Status.MustGet()
|
|
|
|
|
}
|
2026-01-22 03:27:32 +00:00
|
|
|
if !s.OrganizationID.IsUnset() {
|
|
|
|
|
t.OrganizationID = s.OrganizationID.MustGetNull()
|
|
|
|
|
}
|
2026-02-05 21:43:29 +00:00
|
|
|
if s.HasBackyardPermission.IsValue() {
|
|
|
|
|
t.HasBackyardPermission = s.HasBackyardPermission.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.IsReporterConfidential.IsValue() {
|
|
|
|
|
t.IsReporterConfidential = s.IsReporterConfidential.MustGet()
|
|
|
|
|
}
|
|
|
|
|
if s.IsReporterOwner.IsValue() {
|
|
|
|
|
t.IsReporterOwner = s.IsReporterOwner.MustGet()
|
|
|
|
|
}
|
2026-02-06 15:39:49 +00:00
|
|
|
if !s.ReporterContactConsent.IsUnset() {
|
|
|
|
|
t.ReporterContactConsent = s.ReporterContactConsent.MustGetNull()
|
|
|
|
|
}
|
2026-03-08 02:43:00 +00:00
|
|
|
if !s.Location.IsUnset() {
|
|
|
|
|
t.Location = s.Location.MustGetNull()
|
|
|
|
|
}
|
2026-03-08 03:14:38 +00:00
|
|
|
if s.AddressNumber.IsValue() {
|
|
|
|
|
t.AddressNumber = s.AddressNumber.MustGet()
|
|
|
|
|
}
|
2026-03-09 18:02:22 +00:00
|
|
|
if !s.AddressID.IsUnset() {
|
|
|
|
|
t.AddressID = s.AddressID.MustGetNull()
|
|
|
|
|
}
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (s *PublicreportWaterSetter) Apply(q *dialect.InsertQuery) {
|
2026-01-09 19:43:19 +00:00
|
|
|
q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) {
|
2026-03-09 18:02:22 +00:00
|
|
|
return PublicreportWaters.BeforeInsertHooks.RunHooks(ctx, exec, s)
|
2026-01-09 19:43:19 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
2026-03-09 18:02:22 +00:00
|
|
|
vals := make([]bob.Expression, 36)
|
2026-01-09 19:43:19 +00:00
|
|
|
if s.ID.IsValue() {
|
|
|
|
|
vals[0] = psql.Arg(s.ID.MustGet())
|
|
|
|
|
} else {
|
|
|
|
|
vals[0] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.AccessComments.IsValue() {
|
|
|
|
|
vals[1] = psql.Arg(s.AccessComments.MustGet())
|
|
|
|
|
} else {
|
|
|
|
|
vals[1] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.AccessGate.IsValue() {
|
|
|
|
|
vals[2] = psql.Arg(s.AccessGate.MustGet())
|
|
|
|
|
} else {
|
|
|
|
|
vals[2] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.AccessFence.IsValue() {
|
|
|
|
|
vals[3] = psql.Arg(s.AccessFence.MustGet())
|
|
|
|
|
} else {
|
|
|
|
|
vals[3] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.AccessLocked.IsValue() {
|
|
|
|
|
vals[4] = psql.Arg(s.AccessLocked.MustGet())
|
|
|
|
|
} else {
|
|
|
|
|
vals[4] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.AccessDog.IsValue() {
|
|
|
|
|
vals[5] = psql.Arg(s.AccessDog.MustGet())
|
|
|
|
|
} else {
|
|
|
|
|
vals[5] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.AccessOther.IsValue() {
|
|
|
|
|
vals[6] = psql.Arg(s.AccessOther.MustGet())
|
|
|
|
|
} else {
|
|
|
|
|
vals[6] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
if s.AddressRaw.IsValue() {
|
|
|
|
|
vals[7] = psql.Arg(s.AddressRaw.MustGet())
|
2026-01-09 19:43:19 +00:00
|
|
|
} else {
|
|
|
|
|
vals[7] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.AddressCountry.IsValue() {
|
|
|
|
|
vals[8] = psql.Arg(s.AddressCountry.MustGet())
|
|
|
|
|
} else {
|
|
|
|
|
vals[8] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
if s.AddressPostalCode.IsValue() {
|
|
|
|
|
vals[9] = psql.Arg(s.AddressPostalCode.MustGet())
|
2026-01-09 19:43:19 +00:00
|
|
|
} else {
|
|
|
|
|
vals[9] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
if s.AddressLocality.IsValue() {
|
|
|
|
|
vals[10] = psql.Arg(s.AddressLocality.MustGet())
|
2026-01-09 19:43:19 +00:00
|
|
|
} else {
|
|
|
|
|
vals[10] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.AddressStreet.IsValue() {
|
|
|
|
|
vals[11] = psql.Arg(s.AddressStreet.MustGet())
|
|
|
|
|
} else {
|
|
|
|
|
vals[11] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.AddressRegion.IsValue() {
|
|
|
|
|
vals[12] = psql.Arg(s.AddressRegion.MustGet())
|
|
|
|
|
} else {
|
|
|
|
|
vals[12] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.Comments.IsValue() {
|
|
|
|
|
vals[13] = psql.Arg(s.Comments.MustGet())
|
|
|
|
|
} else {
|
|
|
|
|
vals[13] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.Created.IsValue() {
|
|
|
|
|
vals[14] = psql.Arg(s.Created.MustGet())
|
|
|
|
|
} else {
|
|
|
|
|
vals[14] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if !s.H3cell.IsUnset() {
|
|
|
|
|
vals[15] = psql.Arg(s.H3cell.MustGetNull())
|
|
|
|
|
} else {
|
|
|
|
|
vals[15] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.HasAdult.IsValue() {
|
|
|
|
|
vals[16] = psql.Arg(s.HasAdult.MustGet())
|
|
|
|
|
} else {
|
|
|
|
|
vals[16] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.HasLarvae.IsValue() {
|
|
|
|
|
vals[17] = psql.Arg(s.HasLarvae.MustGet())
|
|
|
|
|
} else {
|
|
|
|
|
vals[17] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.HasPupae.IsValue() {
|
|
|
|
|
vals[18] = psql.Arg(s.HasPupae.MustGet())
|
|
|
|
|
} else {
|
|
|
|
|
vals[18] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 02:43:00 +00:00
|
|
|
if s.MapZoom.IsValue() {
|
|
|
|
|
vals[19] = psql.Arg(s.MapZoom.MustGet())
|
2026-01-09 19:43:19 +00:00
|
|
|
} else {
|
|
|
|
|
vals[19] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 02:43:00 +00:00
|
|
|
if s.OwnerEmail.IsValue() {
|
|
|
|
|
vals[20] = psql.Arg(s.OwnerEmail.MustGet())
|
2026-01-09 19:43:19 +00:00
|
|
|
} else {
|
|
|
|
|
vals[20] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 02:43:00 +00:00
|
|
|
if s.OwnerName.IsValue() {
|
|
|
|
|
vals[21] = psql.Arg(s.OwnerName.MustGet())
|
2026-01-09 19:43:19 +00:00
|
|
|
} else {
|
|
|
|
|
vals[21] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 02:43:00 +00:00
|
|
|
if s.OwnerPhone.IsValue() {
|
|
|
|
|
vals[22] = psql.Arg(s.OwnerPhone.MustGet())
|
2026-01-09 19:43:19 +00:00
|
|
|
} else {
|
|
|
|
|
vals[22] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 02:43:00 +00:00
|
|
|
if s.PublicID.IsValue() {
|
|
|
|
|
vals[23] = psql.Arg(s.PublicID.MustGet())
|
2026-01-09 19:43:19 +00:00
|
|
|
} else {
|
|
|
|
|
vals[23] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 02:43:00 +00:00
|
|
|
if s.ReporterEmail.IsValue() {
|
|
|
|
|
vals[24] = psql.Arg(s.ReporterEmail.MustGet())
|
2026-01-09 19:43:19 +00:00
|
|
|
} else {
|
|
|
|
|
vals[24] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 02:43:00 +00:00
|
|
|
if s.ReporterName.IsValue() {
|
|
|
|
|
vals[25] = psql.Arg(s.ReporterName.MustGet())
|
2026-01-09 19:43:19 +00:00
|
|
|
} else {
|
|
|
|
|
vals[25] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 02:43:00 +00:00
|
|
|
if s.ReporterPhone.IsValue() {
|
|
|
|
|
vals[26] = psql.Arg(s.ReporterPhone.MustGet())
|
2026-01-09 19:43:19 +00:00
|
|
|
} else {
|
|
|
|
|
vals[26] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 02:43:00 +00:00
|
|
|
if s.Status.IsValue() {
|
|
|
|
|
vals[27] = psql.Arg(s.Status.MustGet())
|
2026-01-09 19:43:19 +00:00
|
|
|
} else {
|
|
|
|
|
vals[27] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 02:43:00 +00:00
|
|
|
if !s.OrganizationID.IsUnset() {
|
|
|
|
|
vals[28] = psql.Arg(s.OrganizationID.MustGetNull())
|
2026-01-09 19:43:19 +00:00
|
|
|
} else {
|
|
|
|
|
vals[28] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 02:43:00 +00:00
|
|
|
if s.HasBackyardPermission.IsValue() {
|
|
|
|
|
vals[29] = psql.Arg(s.HasBackyardPermission.MustGet())
|
2026-01-13 19:47:19 +00:00
|
|
|
} else {
|
|
|
|
|
vals[29] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 02:43:00 +00:00
|
|
|
if s.IsReporterConfidential.IsValue() {
|
|
|
|
|
vals[30] = psql.Arg(s.IsReporterConfidential.MustGet())
|
2026-01-22 03:27:32 +00:00
|
|
|
} else {
|
|
|
|
|
vals[30] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 02:43:00 +00:00
|
|
|
if s.IsReporterOwner.IsValue() {
|
|
|
|
|
vals[31] = psql.Arg(s.IsReporterOwner.MustGet())
|
2026-02-05 21:43:29 +00:00
|
|
|
} else {
|
|
|
|
|
vals[31] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 02:43:00 +00:00
|
|
|
if !s.ReporterContactConsent.IsUnset() {
|
|
|
|
|
vals[32] = psql.Arg(s.ReporterContactConsent.MustGetNull())
|
2026-02-05 21:43:29 +00:00
|
|
|
} else {
|
|
|
|
|
vals[32] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 02:43:00 +00:00
|
|
|
if !s.Location.IsUnset() {
|
|
|
|
|
vals[33] = psql.Arg(s.Location.MustGetNull())
|
2026-02-06 15:39:49 +00:00
|
|
|
} else {
|
|
|
|
|
vals[33] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 03:14:38 +00:00
|
|
|
if s.AddressNumber.IsValue() {
|
|
|
|
|
vals[34] = psql.Arg(s.AddressNumber.MustGet())
|
|
|
|
|
} else {
|
|
|
|
|
vals[34] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
if !s.AddressID.IsUnset() {
|
|
|
|
|
vals[35] = psql.Arg(s.AddressID.MustGetNull())
|
|
|
|
|
} else {
|
|
|
|
|
vals[35] = psql.Raw("DEFAULT")
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-09 19:43:19 +00:00
|
|
|
return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "")
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (s PublicreportWaterSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] {
|
2026-01-09 19:43:19 +00:00
|
|
|
return um.Set(s.Expressions()...)
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (s PublicreportWaterSetter) Expressions(prefix ...string) []bob.Expression {
|
|
|
|
|
exprs := make([]bob.Expression, 0, 36)
|
2026-01-09 19:43:19 +00:00
|
|
|
|
|
|
|
|
if s.ID.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "id")...),
|
|
|
|
|
psql.Arg(s.ID),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.AccessComments.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "access_comments")...),
|
|
|
|
|
psql.Arg(s.AccessComments),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.AccessGate.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "access_gate")...),
|
|
|
|
|
psql.Arg(s.AccessGate),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.AccessFence.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "access_fence")...),
|
|
|
|
|
psql.Arg(s.AccessFence),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.AccessLocked.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "access_locked")...),
|
|
|
|
|
psql.Arg(s.AccessLocked),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.AccessDog.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "access_dog")...),
|
|
|
|
|
psql.Arg(s.AccessDog),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.AccessOther.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "access_other")...),
|
|
|
|
|
psql.Arg(s.AccessOther),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
if s.AddressRaw.IsValue() {
|
2026-01-09 19:43:19 +00:00
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
2026-03-09 18:02:22 +00:00
|
|
|
psql.Quote(append(prefix, "address_raw")...),
|
|
|
|
|
psql.Arg(s.AddressRaw),
|
2026-01-09 19:43:19 +00:00
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.AddressCountry.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "address_country")...),
|
|
|
|
|
psql.Arg(s.AddressCountry),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
if s.AddressPostalCode.IsValue() {
|
2026-01-09 19:43:19 +00:00
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
2026-03-09 18:02:22 +00:00
|
|
|
psql.Quote(append(prefix, "address_postal_code")...),
|
|
|
|
|
psql.Arg(s.AddressPostalCode),
|
2026-01-09 19:43:19 +00:00
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
if s.AddressLocality.IsValue() {
|
2026-01-09 19:43:19 +00:00
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
2026-03-09 18:02:22 +00:00
|
|
|
psql.Quote(append(prefix, "address_locality")...),
|
|
|
|
|
psql.Arg(s.AddressLocality),
|
2026-01-09 19:43:19 +00:00
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.AddressStreet.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "address_street")...),
|
|
|
|
|
psql.Arg(s.AddressStreet),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.AddressRegion.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "address_region")...),
|
|
|
|
|
psql.Arg(s.AddressRegion),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.Comments.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "comments")...),
|
|
|
|
|
psql.Arg(s.Comments),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.Created.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "created")...),
|
|
|
|
|
psql.Arg(s.Created),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if !s.H3cell.IsUnset() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "h3cell")...),
|
|
|
|
|
psql.Arg(s.H3cell),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.HasAdult.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "has_adult")...),
|
|
|
|
|
psql.Arg(s.HasAdult),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.HasLarvae.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "has_larvae")...),
|
|
|
|
|
psql.Arg(s.HasLarvae),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.HasPupae.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "has_pupae")...),
|
|
|
|
|
psql.Arg(s.HasPupae),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.MapZoom.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "map_zoom")...),
|
|
|
|
|
psql.Arg(s.MapZoom),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.OwnerEmail.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "owner_email")...),
|
|
|
|
|
psql.Arg(s.OwnerEmail),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.OwnerName.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "owner_name")...),
|
|
|
|
|
psql.Arg(s.OwnerName),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.OwnerPhone.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "owner_phone")...),
|
|
|
|
|
psql.Arg(s.OwnerPhone),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.PublicID.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "public_id")...),
|
|
|
|
|
psql.Arg(s.PublicID),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.ReporterEmail.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "reporter_email")...),
|
|
|
|
|
psql.Arg(s.ReporterEmail),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.ReporterName.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "reporter_name")...),
|
|
|
|
|
psql.Arg(s.ReporterName),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.ReporterPhone.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "reporter_phone")...),
|
|
|
|
|
psql.Arg(s.ReporterPhone),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-13 19:47:19 +00:00
|
|
|
if s.Status.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "status")...),
|
|
|
|
|
psql.Arg(s.Status),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-22 03:27:32 +00:00
|
|
|
if !s.OrganizationID.IsUnset() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "organization_id")...),
|
|
|
|
|
psql.Arg(s.OrganizationID),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-05 21:43:29 +00:00
|
|
|
if s.HasBackyardPermission.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "has_backyard_permission")...),
|
|
|
|
|
psql.Arg(s.HasBackyardPermission),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.IsReporterConfidential.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "is_reporter_confidential")...),
|
|
|
|
|
psql.Arg(s.IsReporterConfidential),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if s.IsReporterOwner.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "is_reporter_owner")...),
|
|
|
|
|
psql.Arg(s.IsReporterOwner),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-06 15:39:49 +00:00
|
|
|
if !s.ReporterContactConsent.IsUnset() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "reporter_contact_consent")...),
|
|
|
|
|
psql.Arg(s.ReporterContactConsent),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 02:43:00 +00:00
|
|
|
if !s.Location.IsUnset() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "location")...),
|
|
|
|
|
psql.Arg(s.Location),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-08 03:14:38 +00:00
|
|
|
if s.AddressNumber.IsValue() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "address_number")...),
|
|
|
|
|
psql.Arg(s.AddressNumber),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
if !s.AddressID.IsUnset() {
|
|
|
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
|
|
|
psql.Quote(append(prefix, "address_id")...),
|
|
|
|
|
psql.Arg(s.AddressID),
|
|
|
|
|
}})
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-09 19:43:19 +00:00
|
|
|
return exprs
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// FindPublicreportWater retrieves a single record by primary key
|
2026-01-09 19:43:19 +00:00
|
|
|
// If cols is empty Find will return all columns.
|
2026-03-09 18:02:22 +00:00
|
|
|
func FindPublicreportWater(ctx context.Context, exec bob.Executor, IDPK int32, cols ...string) (*PublicreportWater, error) {
|
2026-01-09 19:43:19 +00:00
|
|
|
if len(cols) == 0 {
|
2026-03-09 18:02:22 +00:00
|
|
|
return PublicreportWaters.Query(
|
|
|
|
|
sm.Where(PublicreportWaters.Columns.ID.EQ(psql.Arg(IDPK))),
|
2026-01-09 19:43:19 +00:00
|
|
|
).One(ctx, exec)
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
return PublicreportWaters.Query(
|
|
|
|
|
sm.Where(PublicreportWaters.Columns.ID.EQ(psql.Arg(IDPK))),
|
|
|
|
|
sm.Columns(PublicreportWaters.Columns.Only(cols...)),
|
2026-01-09 19:43:19 +00:00
|
|
|
).One(ctx, exec)
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// PublicreportWaterExists checks the presence of a single record by primary key
|
|
|
|
|
func PublicreportWaterExists(ctx context.Context, exec bob.Executor, IDPK int32) (bool, error) {
|
|
|
|
|
return PublicreportWaters.Query(
|
|
|
|
|
sm.Where(PublicreportWaters.Columns.ID.EQ(psql.Arg(IDPK))),
|
2026-01-09 19:43:19 +00:00
|
|
|
).Exists(ctx, exec)
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// AfterQueryHook is called after PublicreportWater is retrieved from the database
|
|
|
|
|
func (o *PublicreportWater) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
|
2026-01-09 19:43:19 +00:00
|
|
|
var err error
|
|
|
|
|
|
|
|
|
|
switch queryType {
|
|
|
|
|
case bob.QueryTypeSelect:
|
2026-03-09 18:02:22 +00:00
|
|
|
ctx, err = PublicreportWaters.AfterSelectHooks.RunHooks(ctx, exec, PublicreportWaterSlice{o})
|
2026-01-09 19:43:19 +00:00
|
|
|
case bob.QueryTypeInsert:
|
2026-03-09 18:02:22 +00:00
|
|
|
ctx, err = PublicreportWaters.AfterInsertHooks.RunHooks(ctx, exec, PublicreportWaterSlice{o})
|
2026-01-09 19:43:19 +00:00
|
|
|
case bob.QueryTypeUpdate:
|
2026-03-09 18:02:22 +00:00
|
|
|
ctx, err = PublicreportWaters.AfterUpdateHooks.RunHooks(ctx, exec, PublicreportWaterSlice{o})
|
2026-01-09 19:43:19 +00:00
|
|
|
case bob.QueryTypeDelete:
|
2026-03-09 18:02:22 +00:00
|
|
|
ctx, err = PublicreportWaters.AfterDeleteHooks.RunHooks(ctx, exec, PublicreportWaterSlice{o})
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// primaryKeyVals returns the primary key values of the PublicreportWater
|
|
|
|
|
func (o *PublicreportWater) primaryKeyVals() bob.Expression {
|
2026-01-09 19:43:19 +00:00
|
|
|
return psql.Arg(o.ID)
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (o *PublicreportWater) pkEQ() dialect.Expression {
|
|
|
|
|
return psql.Quote("publicreport.water", "id").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
2026-01-09 19:43:19 +00:00
|
|
|
return o.primaryKeyVals().WriteSQL(ctx, w, d, start)
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// Update uses an executor to update the PublicreportWater
|
|
|
|
|
func (o *PublicreportWater) Update(ctx context.Context, exec bob.Executor, s *PublicreportWaterSetter) error {
|
|
|
|
|
v, err := PublicreportWaters.Update(s.UpdateMod(), um.Where(o.pkEQ())).One(ctx, exec)
|
2026-01-09 19:43:19 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
o.R = v.R
|
|
|
|
|
*o = *v
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// Delete deletes a single PublicreportWater record with an executor
|
|
|
|
|
func (o *PublicreportWater) Delete(ctx context.Context, exec bob.Executor) error {
|
|
|
|
|
_, err := PublicreportWaters.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec)
|
2026-01-09 19:43:19 +00:00
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// Reload refreshes the PublicreportWater using the executor
|
|
|
|
|
func (o *PublicreportWater) Reload(ctx context.Context, exec bob.Executor) error {
|
|
|
|
|
o2, err := PublicreportWaters.Query(
|
|
|
|
|
sm.Where(PublicreportWaters.Columns.ID.EQ(psql.Arg(o.ID))),
|
2026-01-09 19:43:19 +00:00
|
|
|
).One(ctx, exec)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
o2.R = o.R
|
|
|
|
|
*o = *o2
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// AfterQueryHook is called after PublicreportWaterSlice is retrieved from the database
|
|
|
|
|
func (o PublicreportWaterSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
|
2026-01-09 19:43:19 +00:00
|
|
|
var err error
|
|
|
|
|
|
|
|
|
|
switch queryType {
|
|
|
|
|
case bob.QueryTypeSelect:
|
2026-03-09 18:02:22 +00:00
|
|
|
ctx, err = PublicreportWaters.AfterSelectHooks.RunHooks(ctx, exec, o)
|
2026-01-09 19:43:19 +00:00
|
|
|
case bob.QueryTypeInsert:
|
2026-03-09 18:02:22 +00:00
|
|
|
ctx, err = PublicreportWaters.AfterInsertHooks.RunHooks(ctx, exec, o)
|
2026-01-09 19:43:19 +00:00
|
|
|
case bob.QueryTypeUpdate:
|
2026-03-09 18:02:22 +00:00
|
|
|
ctx, err = PublicreportWaters.AfterUpdateHooks.RunHooks(ctx, exec, o)
|
2026-01-09 19:43:19 +00:00
|
|
|
case bob.QueryTypeDelete:
|
2026-03-09 18:02:22 +00:00
|
|
|
ctx, err = PublicreportWaters.AfterDeleteHooks.RunHooks(ctx, exec, o)
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (o PublicreportWaterSlice) pkIN() dialect.Expression {
|
2026-01-09 19:43:19 +00:00
|
|
|
if len(o) == 0 {
|
|
|
|
|
return psql.Raw("NULL")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
return psql.Quote("publicreport.water", "id").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
2026-01-09 19:43:19 +00:00
|
|
|
pkPairs := make([]bob.Expression, len(o))
|
|
|
|
|
for i, row := range o {
|
|
|
|
|
pkPairs[i] = row.primaryKeyVals()
|
|
|
|
|
}
|
|
|
|
|
return bob.ExpressSlice(ctx, w, d, start, pkPairs, "", ", ", "")
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// copyMatchingRows finds models in the given slice that have the same primary key
|
|
|
|
|
// then it first copies the existing relationships from the old model to the new model
|
|
|
|
|
// and then replaces the old model in the slice with the new model
|
2026-03-09 18:02:22 +00:00
|
|
|
func (o PublicreportWaterSlice) copyMatchingRows(from ...*PublicreportWater) {
|
2026-01-09 19:43:19 +00:00
|
|
|
for i, old := range o {
|
|
|
|
|
for _, new := range from {
|
|
|
|
|
if new.ID != old.ID {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
new.R = old.R
|
|
|
|
|
o[i] = new
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// UpdateMod modifies an update query with "WHERE primary_key IN (o...)"
|
2026-03-09 18:02:22 +00:00
|
|
|
func (o PublicreportWaterSlice) UpdateMod() bob.Mod[*dialect.UpdateQuery] {
|
2026-01-09 19:43:19 +00:00
|
|
|
return bob.ModFunc[*dialect.UpdateQuery](func(q *dialect.UpdateQuery) {
|
|
|
|
|
q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) {
|
2026-03-09 18:02:22 +00:00
|
|
|
return PublicreportWaters.BeforeUpdateHooks.RunHooks(ctx, exec, o)
|
2026-01-09 19:43:19 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
q.AppendLoader(bob.LoaderFunc(func(ctx context.Context, exec bob.Executor, retrieved any) error {
|
|
|
|
|
var err error
|
|
|
|
|
switch retrieved := retrieved.(type) {
|
2026-03-09 18:02:22 +00:00
|
|
|
case *PublicreportWater:
|
2026-01-09 19:43:19 +00:00
|
|
|
o.copyMatchingRows(retrieved)
|
2026-03-09 18:02:22 +00:00
|
|
|
case []*PublicreportWater:
|
2026-01-09 19:43:19 +00:00
|
|
|
o.copyMatchingRows(retrieved...)
|
2026-03-09 18:02:22 +00:00
|
|
|
case PublicreportWaterSlice:
|
2026-01-09 19:43:19 +00:00
|
|
|
o.copyMatchingRows(retrieved...)
|
|
|
|
|
default:
|
2026-03-09 18:02:22 +00:00
|
|
|
// If the retrieved value is not a PublicreportWater or a slice of PublicreportWater
|
2026-01-09 19:43:19 +00:00
|
|
|
// then run the AfterUpdateHooks on the slice
|
2026-03-09 18:02:22 +00:00
|
|
|
_, err = PublicreportWaters.AfterUpdateHooks.RunHooks(ctx, exec, o)
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
q.AppendWhere(o.pkIN())
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)"
|
2026-03-09 18:02:22 +00:00
|
|
|
func (o PublicreportWaterSlice) DeleteMod() bob.Mod[*dialect.DeleteQuery] {
|
2026-01-09 19:43:19 +00:00
|
|
|
return bob.ModFunc[*dialect.DeleteQuery](func(q *dialect.DeleteQuery) {
|
|
|
|
|
q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) {
|
2026-03-09 18:02:22 +00:00
|
|
|
return PublicreportWaters.BeforeDeleteHooks.RunHooks(ctx, exec, o)
|
2026-01-09 19:43:19 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
q.AppendLoader(bob.LoaderFunc(func(ctx context.Context, exec bob.Executor, retrieved any) error {
|
|
|
|
|
var err error
|
|
|
|
|
switch retrieved := retrieved.(type) {
|
2026-03-09 18:02:22 +00:00
|
|
|
case *PublicreportWater:
|
2026-01-09 19:43:19 +00:00
|
|
|
o.copyMatchingRows(retrieved)
|
2026-03-09 18:02:22 +00:00
|
|
|
case []*PublicreportWater:
|
2026-01-09 19:43:19 +00:00
|
|
|
o.copyMatchingRows(retrieved...)
|
2026-03-09 18:02:22 +00:00
|
|
|
case PublicreportWaterSlice:
|
2026-01-09 19:43:19 +00:00
|
|
|
o.copyMatchingRows(retrieved...)
|
|
|
|
|
default:
|
2026-03-09 18:02:22 +00:00
|
|
|
// If the retrieved value is not a PublicreportWater or a slice of PublicreportWater
|
2026-01-09 19:43:19 +00:00
|
|
|
// then run the AfterDeleteHooks on the slice
|
2026-03-09 18:02:22 +00:00
|
|
|
_, err = PublicreportWaters.AfterDeleteHooks.RunHooks(ctx, exec, o)
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
q.AppendWhere(o.pkIN())
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (o PublicreportWaterSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals PublicreportWaterSetter) error {
|
2026-01-09 19:43:19 +00:00
|
|
|
if len(o) == 0 {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
_, err := PublicreportWaters.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec)
|
2026-01-09 19:43:19 +00:00
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (o PublicreportWaterSlice) DeleteAll(ctx context.Context, exec bob.Executor) error {
|
2026-01-09 19:43:19 +00:00
|
|
|
if len(o) == 0 {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
_, err := PublicreportWaters.Delete(o.DeleteMod()).Exec(ctx, exec)
|
2026-01-09 19:43:19 +00:00
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (o PublicreportWaterSlice) ReloadAll(ctx context.Context, exec bob.Executor) error {
|
2026-01-09 19:43:19 +00:00
|
|
|
if len(o) == 0 {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
o2, err := PublicreportWaters.Query(sm.Where(o.pkIN())).All(ctx, exec)
|
2026-01-09 19:43:19 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
o.copyMatchingRows(o2...)
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// NotifyEmailWaters starts a query for related objects on publicreport.notify_email_water
|
|
|
|
|
func (o *PublicreportWater) NotifyEmailWaters(mods ...bob.Mod[*dialect.SelectQuery]) PublicreportNotifyEmailWatersQuery {
|
|
|
|
|
return PublicreportNotifyEmailWaters.Query(append(mods,
|
|
|
|
|
sm.Where(PublicreportNotifyEmailWaters.Columns.WaterID.EQ(psql.Arg(o.ID))),
|
2026-02-06 15:39:49 +00:00
|
|
|
)...)
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (os PublicreportWaterSlice) NotifyEmailWaters(mods ...bob.Mod[*dialect.SelectQuery]) PublicreportNotifyEmailWatersQuery {
|
2026-02-06 15:39:49 +00:00
|
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
|
|
|
for _, o := range os {
|
|
|
|
|
if o == nil {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
pkID = append(pkID, o.ID)
|
|
|
|
|
}
|
|
|
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
|
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
|
|
|
))
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
return PublicreportNotifyEmailWaters.Query(append(mods,
|
|
|
|
|
sm.Where(psql.Group(PublicreportNotifyEmailWaters.Columns.WaterID).OP("IN", PKArgExpr)),
|
2026-02-06 15:39:49 +00:00
|
|
|
)...)
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// NotifyPhoneWaters starts a query for related objects on publicreport.notify_phone_water
|
|
|
|
|
func (o *PublicreportWater) NotifyPhoneWaters(mods ...bob.Mod[*dialect.SelectQuery]) PublicreportNotifyPhoneWatersQuery {
|
|
|
|
|
return PublicreportNotifyPhoneWaters.Query(append(mods,
|
|
|
|
|
sm.Where(PublicreportNotifyPhoneWaters.Columns.WaterID.EQ(psql.Arg(o.ID))),
|
2026-02-06 15:39:49 +00:00
|
|
|
)...)
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (os PublicreportWaterSlice) NotifyPhoneWaters(mods ...bob.Mod[*dialect.SelectQuery]) PublicreportNotifyPhoneWatersQuery {
|
2026-02-06 15:39:49 +00:00
|
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
|
|
|
for _, o := range os {
|
|
|
|
|
if o == nil {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
pkID = append(pkID, o.ID)
|
|
|
|
|
}
|
|
|
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
|
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
|
|
|
))
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
return PublicreportNotifyPhoneWaters.Query(append(mods,
|
|
|
|
|
sm.Where(psql.Group(PublicreportNotifyPhoneWaters.Columns.WaterID).OP("IN", PKArgExpr)),
|
|
|
|
|
)...)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Address starts a query for related objects on address
|
|
|
|
|
func (o *PublicreportWater) Address(mods ...bob.Mod[*dialect.SelectQuery]) AddressesQuery {
|
|
|
|
|
return Addresses.Query(append(mods,
|
|
|
|
|
sm.Where(Addresses.Columns.ID.EQ(psql.Arg(o.AddressID))),
|
|
|
|
|
)...)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (os PublicreportWaterSlice) Address(mods ...bob.Mod[*dialect.SelectQuery]) AddressesQuery {
|
|
|
|
|
pkAddressID := make(pgtypes.Array[null.Val[int32]], 0, len(os))
|
|
|
|
|
for _, o := range os {
|
|
|
|
|
if o == nil {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
pkAddressID = append(pkAddressID, o.AddressID)
|
|
|
|
|
}
|
|
|
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
|
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkAddressID), "integer[]")),
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
return Addresses.Query(append(mods,
|
|
|
|
|
sm.Where(psql.Group(Addresses.Columns.ID).OP("IN", PKArgExpr)),
|
2026-02-06 15:39:49 +00:00
|
|
|
)...)
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-22 03:27:32 +00:00
|
|
|
// Organization starts a query for related objects on organization
|
2026-03-09 18:02:22 +00:00
|
|
|
func (o *PublicreportWater) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery {
|
2026-01-22 03:27:32 +00:00
|
|
|
return Organizations.Query(append(mods,
|
|
|
|
|
sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))),
|
|
|
|
|
)...)
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (os PublicreportWaterSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery {
|
2026-01-22 03:27:32 +00:00
|
|
|
pkOrganizationID := make(pgtypes.Array[null.Val[int32]], 0, len(os))
|
|
|
|
|
for _, o := range os {
|
|
|
|
|
if o == nil {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
pkOrganizationID = append(pkOrganizationID, o.OrganizationID)
|
|
|
|
|
}
|
|
|
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
|
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkOrganizationID), "integer[]")),
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
return Organizations.Query(append(mods,
|
|
|
|
|
sm.Where(psql.Group(Organizations.Columns.ID).OP("IN", PKArgExpr)),
|
|
|
|
|
)...)
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-16 14:52:11 +00:00
|
|
|
// Images starts a query for related objects on publicreport.image
|
2026-03-09 18:02:22 +00:00
|
|
|
func (o *PublicreportWater) Images(mods ...bob.Mod[*dialect.SelectQuery]) PublicreportImagesQuery {
|
2026-01-16 14:52:11 +00:00
|
|
|
return PublicreportImages.Query(append(mods,
|
2026-03-09 18:02:22 +00:00
|
|
|
sm.InnerJoin(PublicreportWaterImages.NameAs()).On(
|
|
|
|
|
PublicreportImages.Columns.ID.EQ(PublicreportWaterImages.Columns.ImageID)),
|
|
|
|
|
sm.Where(PublicreportWaterImages.Columns.WaterID.EQ(psql.Arg(o.ID))),
|
2026-01-09 19:43:19 +00:00
|
|
|
)...)
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (os PublicreportWaterSlice) Images(mods ...bob.Mod[*dialect.SelectQuery]) PublicreportImagesQuery {
|
2026-01-09 19:43:19 +00:00
|
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
|
|
|
for _, o := range os {
|
|
|
|
|
if o == nil {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
pkID = append(pkID, o.ID)
|
|
|
|
|
}
|
|
|
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
|
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
|
|
|
))
|
|
|
|
|
|
2026-01-16 14:52:11 +00:00
|
|
|
return PublicreportImages.Query(append(mods,
|
2026-03-09 18:02:22 +00:00
|
|
|
sm.InnerJoin(PublicreportWaterImages.NameAs()).On(
|
|
|
|
|
PublicreportImages.Columns.ID.EQ(PublicreportWaterImages.Columns.ImageID),
|
2026-01-16 14:52:11 +00:00
|
|
|
),
|
2026-03-09 18:02:22 +00:00
|
|
|
sm.Where(psql.Group(PublicreportWaterImages.Columns.WaterID).OP("IN", PKArgExpr)),
|
2026-01-09 19:43:19 +00:00
|
|
|
)...)
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func insertPublicreportWaterNotifyEmailWaters0(ctx context.Context, exec bob.Executor, publicreportNotifyEmailWaters1 []*PublicreportNotifyEmailWaterSetter, publicreportWater0 *PublicreportWater) (PublicreportNotifyEmailWaterSlice, error) {
|
|
|
|
|
for i := range publicreportNotifyEmailWaters1 {
|
|
|
|
|
publicreportNotifyEmailWaters1[i].WaterID = omit.From(publicreportWater0.ID)
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
ret, err := PublicreportNotifyEmailWaters.Insert(bob.ToMods(publicreportNotifyEmailWaters1...)).All(ctx, exec)
|
2026-02-06 15:39:49 +00:00
|
|
|
if err != nil {
|
2026-03-09 18:02:22 +00:00
|
|
|
return ret, fmt.Errorf("insertPublicreportWaterNotifyEmailWaters0: %w", err)
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret, nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func attachPublicreportWaterNotifyEmailWaters0(ctx context.Context, exec bob.Executor, count int, publicreportNotifyEmailWaters1 PublicreportNotifyEmailWaterSlice, publicreportWater0 *PublicreportWater) (PublicreportNotifyEmailWaterSlice, error) {
|
|
|
|
|
setter := &PublicreportNotifyEmailWaterSetter{
|
|
|
|
|
WaterID: omit.From(publicreportWater0.ID),
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
err := publicreportNotifyEmailWaters1.UpdateAll(ctx, exec, *setter)
|
2026-02-06 15:39:49 +00:00
|
|
|
if err != nil {
|
2026-03-09 18:02:22 +00:00
|
|
|
return nil, fmt.Errorf("attachPublicreportWaterNotifyEmailWaters0: %w", err)
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
return publicreportNotifyEmailWaters1, nil
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (publicreportWater0 *PublicreportWater) InsertNotifyEmailWaters(ctx context.Context, exec bob.Executor, related ...*PublicreportNotifyEmailWaterSetter) error {
|
2026-02-06 15:39:49 +00:00
|
|
|
if len(related) == 0 {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var err error
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
publicreportNotifyEmailWaters1, err := insertPublicreportWaterNotifyEmailWaters0(ctx, exec, related, publicreportWater0)
|
2026-02-06 15:39:49 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
publicreportWater0.R.NotifyEmailWaters = append(publicreportWater0.R.NotifyEmailWaters, publicreportNotifyEmailWaters1...)
|
2026-02-06 15:39:49 +00:00
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
for _, rel := range publicreportNotifyEmailWaters1 {
|
|
|
|
|
rel.R.Water = publicreportWater0
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (publicreportWater0 *PublicreportWater) AttachNotifyEmailWaters(ctx context.Context, exec bob.Executor, related ...*PublicreportNotifyEmailWater) error {
|
2026-02-06 15:39:49 +00:00
|
|
|
if len(related) == 0 {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var err error
|
2026-03-09 18:02:22 +00:00
|
|
|
publicreportNotifyEmailWaters1 := PublicreportNotifyEmailWaterSlice(related)
|
2026-02-06 15:39:49 +00:00
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
_, err = attachPublicreportWaterNotifyEmailWaters0(ctx, exec, len(related), publicreportNotifyEmailWaters1, publicreportWater0)
|
2026-02-06 15:39:49 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
publicreportWater0.R.NotifyEmailWaters = append(publicreportWater0.R.NotifyEmailWaters, publicreportNotifyEmailWaters1...)
|
2026-02-06 15:39:49 +00:00
|
|
|
|
|
|
|
|
for _, rel := range related {
|
2026-03-09 18:02:22 +00:00
|
|
|
rel.R.Water = publicreportWater0
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func insertPublicreportWaterNotifyPhoneWaters0(ctx context.Context, exec bob.Executor, publicreportNotifyPhoneWaters1 []*PublicreportNotifyPhoneWaterSetter, publicreportWater0 *PublicreportWater) (PublicreportNotifyPhoneWaterSlice, error) {
|
|
|
|
|
for i := range publicreportNotifyPhoneWaters1 {
|
|
|
|
|
publicreportNotifyPhoneWaters1[i].WaterID = omit.From(publicreportWater0.ID)
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
ret, err := PublicreportNotifyPhoneWaters.Insert(bob.ToMods(publicreportNotifyPhoneWaters1...)).All(ctx, exec)
|
2026-02-06 15:39:49 +00:00
|
|
|
if err != nil {
|
2026-03-09 18:02:22 +00:00
|
|
|
return ret, fmt.Errorf("insertPublicreportWaterNotifyPhoneWaters0: %w", err)
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret, nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func attachPublicreportWaterNotifyPhoneWaters0(ctx context.Context, exec bob.Executor, count int, publicreportNotifyPhoneWaters1 PublicreportNotifyPhoneWaterSlice, publicreportWater0 *PublicreportWater) (PublicreportNotifyPhoneWaterSlice, error) {
|
|
|
|
|
setter := &PublicreportNotifyPhoneWaterSetter{
|
|
|
|
|
WaterID: omit.From(publicreportWater0.ID),
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
err := publicreportNotifyPhoneWaters1.UpdateAll(ctx, exec, *setter)
|
2026-02-06 15:39:49 +00:00
|
|
|
if err != nil {
|
2026-03-09 18:02:22 +00:00
|
|
|
return nil, fmt.Errorf("attachPublicreportWaterNotifyPhoneWaters0: %w", err)
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
return publicreportNotifyPhoneWaters1, nil
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (publicreportWater0 *PublicreportWater) InsertNotifyPhoneWaters(ctx context.Context, exec bob.Executor, related ...*PublicreportNotifyPhoneWaterSetter) error {
|
2026-02-06 15:39:49 +00:00
|
|
|
if len(related) == 0 {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var err error
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
publicreportNotifyPhoneWaters1, err := insertPublicreportWaterNotifyPhoneWaters0(ctx, exec, related, publicreportWater0)
|
2026-02-06 15:39:49 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
publicreportWater0.R.NotifyPhoneWaters = append(publicreportWater0.R.NotifyPhoneWaters, publicreportNotifyPhoneWaters1...)
|
2026-02-06 15:39:49 +00:00
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
for _, rel := range publicreportNotifyPhoneWaters1 {
|
|
|
|
|
rel.R.Water = publicreportWater0
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (publicreportWater0 *PublicreportWater) AttachNotifyPhoneWaters(ctx context.Context, exec bob.Executor, related ...*PublicreportNotifyPhoneWater) error {
|
2026-02-06 15:39:49 +00:00
|
|
|
if len(related) == 0 {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var err error
|
2026-03-09 18:02:22 +00:00
|
|
|
publicreportNotifyPhoneWaters1 := PublicreportNotifyPhoneWaterSlice(related)
|
2026-02-06 15:39:49 +00:00
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
_, err = attachPublicreportWaterNotifyPhoneWaters0(ctx, exec, len(related), publicreportNotifyPhoneWaters1, publicreportWater0)
|
2026-02-06 15:39:49 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
publicreportWater0.R.NotifyPhoneWaters = append(publicreportWater0.R.NotifyPhoneWaters, publicreportNotifyPhoneWaters1...)
|
2026-02-06 15:39:49 +00:00
|
|
|
|
|
|
|
|
for _, rel := range related {
|
2026-03-09 18:02:22 +00:00
|
|
|
rel.R.Water = publicreportWater0
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func attachPublicreportWaterAddress0(ctx context.Context, exec bob.Executor, count int, publicreportWater0 *PublicreportWater, address1 *Address) (*PublicreportWater, error) {
|
|
|
|
|
setter := &PublicreportWaterSetter{
|
|
|
|
|
AddressID: omitnull.From(address1.ID),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
err := publicreportWater0.Update(ctx, exec, setter)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, fmt.Errorf("attachPublicreportWaterAddress0: %w", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return publicreportWater0, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (publicreportWater0 *PublicreportWater) InsertAddress(ctx context.Context, exec bob.Executor, related *AddressSetter) error {
|
|
|
|
|
var err error
|
|
|
|
|
|
|
|
|
|
address1, err := Addresses.Insert(related).One(ctx, exec)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return fmt.Errorf("inserting related objects: %w", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_, err = attachPublicreportWaterAddress0(ctx, exec, 1, publicreportWater0, address1)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
publicreportWater0.R.Address = address1
|
|
|
|
|
|
|
|
|
|
address1.R.Waters = append(address1.R.Waters, publicreportWater0)
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (publicreportWater0 *PublicreportWater) AttachAddress(ctx context.Context, exec bob.Executor, address1 *Address) error {
|
|
|
|
|
var err error
|
|
|
|
|
|
|
|
|
|
_, err = attachPublicreportWaterAddress0(ctx, exec, 1, publicreportWater0, address1)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
publicreportWater0.R.Address = address1
|
|
|
|
|
|
|
|
|
|
address1.R.Waters = append(address1.R.Waters, publicreportWater0)
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func attachPublicreportWaterOrganization0(ctx context.Context, exec bob.Executor, count int, publicreportWater0 *PublicreportWater, organization1 *Organization) (*PublicreportWater, error) {
|
|
|
|
|
setter := &PublicreportWaterSetter{
|
2026-01-22 03:27:32 +00:00
|
|
|
OrganizationID: omitnull.From(organization1.ID),
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
err := publicreportWater0.Update(ctx, exec, setter)
|
2026-01-22 03:27:32 +00:00
|
|
|
if err != nil {
|
2026-03-09 18:02:22 +00:00
|
|
|
return nil, fmt.Errorf("attachPublicreportWaterOrganization0: %w", err)
|
2026-01-22 03:27:32 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
return publicreportWater0, nil
|
2026-01-22 03:27:32 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (publicreportWater0 *PublicreportWater) InsertOrganization(ctx context.Context, exec bob.Executor, related *OrganizationSetter) error {
|
2026-01-22 03:27:32 +00:00
|
|
|
var err error
|
|
|
|
|
|
|
|
|
|
organization1, err := Organizations.Insert(related).One(ctx, exec)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return fmt.Errorf("inserting related objects: %w", err)
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
_, err = attachPublicreportWaterOrganization0(ctx, exec, 1, publicreportWater0, organization1)
|
2026-01-22 03:27:32 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
publicreportWater0.R.Organization = organization1
|
2026-01-22 03:27:32 +00:00
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
organization1.R.Waters = append(organization1.R.Waters, publicreportWater0)
|
2026-01-22 03:27:32 +00:00
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (publicreportWater0 *PublicreportWater) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error {
|
2026-01-22 03:27:32 +00:00
|
|
|
var err error
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
_, err = attachPublicreportWaterOrganization0(ctx, exec, 1, publicreportWater0, organization1)
|
2026-01-22 03:27:32 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
publicreportWater0.R.Organization = organization1
|
2026-01-22 03:27:32 +00:00
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
organization1.R.Waters = append(organization1.R.Waters, publicreportWater0)
|
2026-01-22 03:27:32 +00:00
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func attachPublicreportWaterImages0(ctx context.Context, exec bob.Executor, count int, publicreportWater0 *PublicreportWater, publicreportImages2 PublicreportImageSlice) (PublicreportWaterImageSlice, error) {
|
|
|
|
|
setters := make([]*PublicreportWaterImageSetter, count)
|
2026-01-16 14:52:11 +00:00
|
|
|
for i := range count {
|
2026-03-09 18:02:22 +00:00
|
|
|
setters[i] = &PublicreportWaterImageSetter{
|
|
|
|
|
WaterID: omit.From(publicreportWater0.ID),
|
2026-01-16 14:52:11 +00:00
|
|
|
ImageID: omit.From(publicreportImages2[i].ID),
|
|
|
|
|
}
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
publicreportWaterImages1, err := PublicreportWaterImages.Insert(bob.ToMods(setters...)).All(ctx, exec)
|
2026-01-09 19:43:19 +00:00
|
|
|
if err != nil {
|
2026-03-09 18:02:22 +00:00
|
|
|
return nil, fmt.Errorf("attachPublicreportWaterImages0: %w", err)
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
return publicreportWaterImages1, nil
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (publicreportWater0 *PublicreportWater) InsertImages(ctx context.Context, exec bob.Executor, related ...*PublicreportImageSetter) error {
|
2026-01-09 19:43:19 +00:00
|
|
|
if len(related) == 0 {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var err error
|
|
|
|
|
|
2026-01-16 14:52:11 +00:00
|
|
|
inserted, err := PublicreportImages.Insert(bob.ToMods(related...)).All(ctx, exec)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return fmt.Errorf("inserting related objects: %w", err)
|
|
|
|
|
}
|
|
|
|
|
publicreportImages2 := PublicreportImageSlice(inserted)
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
_, err = attachPublicreportWaterImages0(ctx, exec, len(related), publicreportWater0, publicreportImages2)
|
2026-01-09 19:43:19 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
publicreportWater0.R.Images = append(publicreportWater0.R.Images, publicreportImages2...)
|
2026-01-09 19:43:19 +00:00
|
|
|
|
2026-01-16 14:52:11 +00:00
|
|
|
for _, rel := range publicreportImages2 {
|
2026-03-09 18:02:22 +00:00
|
|
|
rel.R.Waters = append(rel.R.Waters, publicreportWater0)
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (publicreportWater0 *PublicreportWater) AttachImages(ctx context.Context, exec bob.Executor, related ...*PublicreportImage) error {
|
2026-01-09 19:43:19 +00:00
|
|
|
if len(related) == 0 {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var err error
|
2026-01-16 14:52:11 +00:00
|
|
|
publicreportImages2 := PublicreportImageSlice(related)
|
2026-01-09 19:43:19 +00:00
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
_, err = attachPublicreportWaterImages0(ctx, exec, len(related), publicreportWater0, publicreportImages2)
|
2026-01-09 19:43:19 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
publicreportWater0.R.Images = append(publicreportWater0.R.Images, publicreportImages2...)
|
2026-01-09 19:43:19 +00:00
|
|
|
|
|
|
|
|
for _, rel := range related {
|
2026-03-09 18:02:22 +00:00
|
|
|
rel.R.Waters = append(rel.R.Waters, publicreportWater0)
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
type publicreportWaterWhere[Q psql.Filterable] struct {
|
2026-02-05 21:43:29 +00:00
|
|
|
ID psql.WhereMod[Q, int32]
|
|
|
|
|
AccessComments psql.WhereMod[Q, string]
|
|
|
|
|
AccessGate psql.WhereMod[Q, bool]
|
|
|
|
|
AccessFence psql.WhereMod[Q, bool]
|
|
|
|
|
AccessLocked psql.WhereMod[Q, bool]
|
|
|
|
|
AccessDog psql.WhereMod[Q, bool]
|
|
|
|
|
AccessOther psql.WhereMod[Q, bool]
|
2026-03-09 18:02:22 +00:00
|
|
|
AddressRaw psql.WhereMod[Q, string]
|
2026-02-05 21:43:29 +00:00
|
|
|
AddressCountry psql.WhereMod[Q, string]
|
2026-03-09 18:02:22 +00:00
|
|
|
AddressPostalCode psql.WhereMod[Q, string]
|
|
|
|
|
AddressLocality psql.WhereMod[Q, string]
|
2026-02-05 21:43:29 +00:00
|
|
|
AddressStreet psql.WhereMod[Q, string]
|
|
|
|
|
AddressRegion psql.WhereMod[Q, string]
|
|
|
|
|
Comments psql.WhereMod[Q, string]
|
|
|
|
|
Created psql.WhereMod[Q, time.Time]
|
|
|
|
|
H3cell psql.WhereNullMod[Q, string]
|
|
|
|
|
HasAdult psql.WhereMod[Q, bool]
|
|
|
|
|
HasLarvae psql.WhereMod[Q, bool]
|
|
|
|
|
HasPupae psql.WhereMod[Q, bool]
|
|
|
|
|
MapZoom psql.WhereMod[Q, float32]
|
|
|
|
|
OwnerEmail psql.WhereMod[Q, string]
|
|
|
|
|
OwnerName psql.WhereMod[Q, string]
|
|
|
|
|
OwnerPhone psql.WhereMod[Q, string]
|
|
|
|
|
PublicID psql.WhereMod[Q, string]
|
|
|
|
|
ReporterEmail psql.WhereMod[Q, string]
|
|
|
|
|
ReporterName psql.WhereMod[Q, string]
|
|
|
|
|
ReporterPhone psql.WhereMod[Q, string]
|
|
|
|
|
Status psql.WhereMod[Q, enums.PublicreportReportstatustype]
|
|
|
|
|
OrganizationID psql.WhereNullMod[Q, int32]
|
|
|
|
|
HasBackyardPermission psql.WhereMod[Q, bool]
|
|
|
|
|
IsReporterConfidential psql.WhereMod[Q, bool]
|
|
|
|
|
IsReporterOwner psql.WhereMod[Q, bool]
|
2026-02-06 15:39:49 +00:00
|
|
|
ReporterContactConsent psql.WhereNullMod[Q, bool]
|
2026-03-08 02:43:00 +00:00
|
|
|
Location psql.WhereNullMod[Q, string]
|
2026-03-08 03:14:38 +00:00
|
|
|
AddressNumber psql.WhereMod[Q, string]
|
2026-03-09 18:02:22 +00:00
|
|
|
AddressID psql.WhereNullMod[Q, int32]
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (publicreportWaterWhere[Q]) AliasedAs(alias string) publicreportWaterWhere[Q] {
|
|
|
|
|
return buildPublicreportWaterWhere[Q](buildPublicreportWaterColumns(alias))
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func buildPublicreportWaterWhere[Q psql.Filterable](cols publicreportWaterColumns) publicreportWaterWhere[Q] {
|
|
|
|
|
return publicreportWaterWhere[Q]{
|
2026-02-05 21:43:29 +00:00
|
|
|
ID: psql.Where[Q, int32](cols.ID),
|
|
|
|
|
AccessComments: psql.Where[Q, string](cols.AccessComments),
|
|
|
|
|
AccessGate: psql.Where[Q, bool](cols.AccessGate),
|
|
|
|
|
AccessFence: psql.Where[Q, bool](cols.AccessFence),
|
|
|
|
|
AccessLocked: psql.Where[Q, bool](cols.AccessLocked),
|
|
|
|
|
AccessDog: psql.Where[Q, bool](cols.AccessDog),
|
|
|
|
|
AccessOther: psql.Where[Q, bool](cols.AccessOther),
|
2026-03-09 18:02:22 +00:00
|
|
|
AddressRaw: psql.Where[Q, string](cols.AddressRaw),
|
2026-02-05 21:43:29 +00:00
|
|
|
AddressCountry: psql.Where[Q, string](cols.AddressCountry),
|
2026-03-09 18:02:22 +00:00
|
|
|
AddressPostalCode: psql.Where[Q, string](cols.AddressPostalCode),
|
|
|
|
|
AddressLocality: psql.Where[Q, string](cols.AddressLocality),
|
2026-02-05 21:43:29 +00:00
|
|
|
AddressStreet: psql.Where[Q, string](cols.AddressStreet),
|
|
|
|
|
AddressRegion: psql.Where[Q, string](cols.AddressRegion),
|
|
|
|
|
Comments: psql.Where[Q, string](cols.Comments),
|
|
|
|
|
Created: psql.Where[Q, time.Time](cols.Created),
|
|
|
|
|
H3cell: psql.WhereNull[Q, string](cols.H3cell),
|
|
|
|
|
HasAdult: psql.Where[Q, bool](cols.HasAdult),
|
|
|
|
|
HasLarvae: psql.Where[Q, bool](cols.HasLarvae),
|
|
|
|
|
HasPupae: psql.Where[Q, bool](cols.HasPupae),
|
|
|
|
|
MapZoom: psql.Where[Q, float32](cols.MapZoom),
|
|
|
|
|
OwnerEmail: psql.Where[Q, string](cols.OwnerEmail),
|
|
|
|
|
OwnerName: psql.Where[Q, string](cols.OwnerName),
|
|
|
|
|
OwnerPhone: psql.Where[Q, string](cols.OwnerPhone),
|
|
|
|
|
PublicID: psql.Where[Q, string](cols.PublicID),
|
|
|
|
|
ReporterEmail: psql.Where[Q, string](cols.ReporterEmail),
|
|
|
|
|
ReporterName: psql.Where[Q, string](cols.ReporterName),
|
|
|
|
|
ReporterPhone: psql.Where[Q, string](cols.ReporterPhone),
|
|
|
|
|
Status: psql.Where[Q, enums.PublicreportReportstatustype](cols.Status),
|
|
|
|
|
OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID),
|
|
|
|
|
HasBackyardPermission: psql.Where[Q, bool](cols.HasBackyardPermission),
|
|
|
|
|
IsReporterConfidential: psql.Where[Q, bool](cols.IsReporterConfidential),
|
|
|
|
|
IsReporterOwner: psql.Where[Q, bool](cols.IsReporterOwner),
|
2026-02-06 15:39:49 +00:00
|
|
|
ReporterContactConsent: psql.WhereNull[Q, bool](cols.ReporterContactConsent),
|
2026-03-08 02:43:00 +00:00
|
|
|
Location: psql.WhereNull[Q, string](cols.Location),
|
2026-03-08 03:14:38 +00:00
|
|
|
AddressNumber: psql.Where[Q, string](cols.AddressNumber),
|
2026-03-09 18:02:22 +00:00
|
|
|
AddressID: psql.WhereNull[Q, int32](cols.AddressID),
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func (o *PublicreportWater) Preload(name string, retrieved any) error {
|
2026-01-09 19:43:19 +00:00
|
|
|
if o == nil {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch name {
|
2026-03-09 18:02:22 +00:00
|
|
|
case "NotifyEmailWaters":
|
|
|
|
|
rels, ok := retrieved.(PublicreportNotifyEmailWaterSlice)
|
2026-02-06 15:39:49 +00:00
|
|
|
if !ok {
|
2026-03-09 18:02:22 +00:00
|
|
|
return fmt.Errorf("publicreportWater cannot load %T as %q", retrieved, name)
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
o.R.NotifyEmailWaters = rels
|
2026-02-06 15:39:49 +00:00
|
|
|
|
|
|
|
|
for _, rel := range rels {
|
|
|
|
|
if rel != nil {
|
2026-03-09 18:02:22 +00:00
|
|
|
rel.R.Water = o
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return nil
|
2026-03-09 18:02:22 +00:00
|
|
|
case "NotifyPhoneWaters":
|
|
|
|
|
rels, ok := retrieved.(PublicreportNotifyPhoneWaterSlice)
|
2026-02-06 15:39:49 +00:00
|
|
|
if !ok {
|
2026-03-09 18:02:22 +00:00
|
|
|
return fmt.Errorf("publicreportWater cannot load %T as %q", retrieved, name)
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
o.R.NotifyPhoneWaters = rels
|
2026-02-06 15:39:49 +00:00
|
|
|
|
|
|
|
|
for _, rel := range rels {
|
|
|
|
|
if rel != nil {
|
2026-03-09 18:02:22 +00:00
|
|
|
rel.R.Water = o
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return nil
|
2026-03-09 18:02:22 +00:00
|
|
|
case "Address":
|
|
|
|
|
rel, ok := retrieved.(*Address)
|
|
|
|
|
if !ok {
|
|
|
|
|
return fmt.Errorf("publicreportWater cannot load %T as %q", retrieved, name)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
o.R.Address = rel
|
|
|
|
|
|
|
|
|
|
if rel != nil {
|
|
|
|
|
rel.R.Waters = PublicreportWaterSlice{o}
|
|
|
|
|
}
|
|
|
|
|
return nil
|
2026-01-22 03:27:32 +00:00
|
|
|
case "Organization":
|
|
|
|
|
rel, ok := retrieved.(*Organization)
|
|
|
|
|
if !ok {
|
2026-03-09 18:02:22 +00:00
|
|
|
return fmt.Errorf("publicreportWater cannot load %T as %q", retrieved, name)
|
2026-01-22 03:27:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
o.R.Organization = rel
|
|
|
|
|
|
|
|
|
|
if rel != nil {
|
2026-03-09 18:02:22 +00:00
|
|
|
rel.R.Waters = PublicreportWaterSlice{o}
|
2026-01-22 03:27:32 +00:00
|
|
|
}
|
|
|
|
|
return nil
|
2026-01-16 14:52:11 +00:00
|
|
|
case "Images":
|
|
|
|
|
rels, ok := retrieved.(PublicreportImageSlice)
|
2026-01-09 19:43:19 +00:00
|
|
|
if !ok {
|
2026-03-09 18:02:22 +00:00
|
|
|
return fmt.Errorf("publicreportWater cannot load %T as %q", retrieved, name)
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
2026-01-16 14:52:11 +00:00
|
|
|
o.R.Images = rels
|
2026-01-09 19:43:19 +00:00
|
|
|
|
|
|
|
|
for _, rel := range rels {
|
|
|
|
|
if rel != nil {
|
2026-03-09 18:02:22 +00:00
|
|
|
rel.R.Waters = PublicreportWaterSlice{o}
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
default:
|
2026-03-09 18:02:22 +00:00
|
|
|
return fmt.Errorf("publicreportWater has no relationship %q", name)
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
type publicreportWaterPreloader struct {
|
|
|
|
|
Address func(...psql.PreloadOption) psql.Preloader
|
2026-01-22 03:27:32 +00:00
|
|
|
Organization func(...psql.PreloadOption) psql.Preloader
|
|
|
|
|
}
|
2026-01-09 19:43:19 +00:00
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func buildPublicreportWaterPreloader() publicreportWaterPreloader {
|
|
|
|
|
return publicreportWaterPreloader{
|
|
|
|
|
Address: func(opts ...psql.PreloadOption) psql.Preloader {
|
|
|
|
|
return psql.Preload[*Address, AddressSlice](psql.PreloadRel{
|
|
|
|
|
Name: "Address",
|
|
|
|
|
Sides: []psql.PreloadSide{
|
|
|
|
|
{
|
|
|
|
|
From: PublicreportWaters,
|
|
|
|
|
To: Addresses,
|
|
|
|
|
FromColumns: []string{"address_id"},
|
|
|
|
|
ToColumns: []string{"id"},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}, Addresses.Columns.Names(), opts...)
|
|
|
|
|
},
|
2026-01-22 03:27:32 +00:00
|
|
|
Organization: func(opts ...psql.PreloadOption) psql.Preloader {
|
|
|
|
|
return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{
|
|
|
|
|
Name: "Organization",
|
|
|
|
|
Sides: []psql.PreloadSide{
|
|
|
|
|
{
|
2026-03-09 18:02:22 +00:00
|
|
|
From: PublicreportWaters,
|
2026-01-22 03:27:32 +00:00
|
|
|
To: Organizations,
|
|
|
|
|
FromColumns: []string{"organization_id"},
|
|
|
|
|
ToColumns: []string{"id"},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}, Organizations.Columns.Names(), opts...)
|
|
|
|
|
},
|
|
|
|
|
}
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
type publicreportWaterThenLoader[Q orm.Loadable] struct {
|
|
|
|
|
NotifyEmailWaters func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
|
|
|
NotifyPhoneWaters func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
|
|
|
Address func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
|
|
|
Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
|
|
|
Images func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
func buildPublicreportWaterThenLoader[Q orm.Loadable]() publicreportWaterThenLoader[Q] {
|
|
|
|
|
type NotifyEmailWatersLoadInterface interface {
|
|
|
|
|
LoadNotifyEmailWaters(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
|
|
|
}
|
|
|
|
|
type NotifyPhoneWatersLoadInterface interface {
|
|
|
|
|
LoadNotifyPhoneWaters(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
2026-03-09 18:02:22 +00:00
|
|
|
type AddressLoadInterface interface {
|
|
|
|
|
LoadAddress(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
2026-01-22 03:27:32 +00:00
|
|
|
type OrganizationLoadInterface interface {
|
|
|
|
|
LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
|
|
|
}
|
2026-01-16 14:52:11 +00:00
|
|
|
type ImagesLoadInterface interface {
|
|
|
|
|
LoadImages(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
return publicreportWaterThenLoader[Q]{
|
|
|
|
|
NotifyEmailWaters: thenLoadBuilder[Q](
|
|
|
|
|
"NotifyEmailWaters",
|
|
|
|
|
func(ctx context.Context, exec bob.Executor, retrieved NotifyEmailWatersLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
|
|
|
return retrieved.LoadNotifyEmailWaters(ctx, exec, mods...)
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
NotifyPhoneWaters: thenLoadBuilder[Q](
|
|
|
|
|
"NotifyPhoneWaters",
|
|
|
|
|
func(ctx context.Context, exec bob.Executor, retrieved NotifyPhoneWatersLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
|
|
|
return retrieved.LoadNotifyPhoneWaters(ctx, exec, mods...)
|
2026-02-06 15:39:49 +00:00
|
|
|
},
|
|
|
|
|
),
|
2026-03-09 18:02:22 +00:00
|
|
|
Address: thenLoadBuilder[Q](
|
|
|
|
|
"Address",
|
|
|
|
|
func(ctx context.Context, exec bob.Executor, retrieved AddressLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
|
|
|
return retrieved.LoadAddress(ctx, exec, mods...)
|
2026-02-06 15:39:49 +00:00
|
|
|
},
|
|
|
|
|
),
|
2026-01-22 03:27:32 +00:00
|
|
|
Organization: thenLoadBuilder[Q](
|
|
|
|
|
"Organization",
|
|
|
|
|
func(ctx context.Context, exec bob.Executor, retrieved OrganizationLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
|
|
|
return retrieved.LoadOrganization(ctx, exec, mods...)
|
|
|
|
|
},
|
|
|
|
|
),
|
2026-01-16 14:52:11 +00:00
|
|
|
Images: thenLoadBuilder[Q](
|
|
|
|
|
"Images",
|
|
|
|
|
func(ctx context.Context, exec bob.Executor, retrieved ImagesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
|
|
|
return retrieved.LoadImages(ctx, exec, mods...)
|
2026-01-09 19:43:19 +00:00
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// LoadNotifyEmailWaters loads the publicreportWater's NotifyEmailWaters into the .R struct
|
|
|
|
|
func (o *PublicreportWater) LoadNotifyEmailWaters(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
2026-02-06 15:39:49 +00:00
|
|
|
if o == nil {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reset the relationship
|
2026-03-09 18:02:22 +00:00
|
|
|
o.R.NotifyEmailWaters = nil
|
2026-02-06 15:39:49 +00:00
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
related, err := o.NotifyEmailWaters(mods...).All(ctx, exec)
|
2026-02-06 15:39:49 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, rel := range related {
|
2026-03-09 18:02:22 +00:00
|
|
|
rel.R.Water = o
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
o.R.NotifyEmailWaters = related
|
2026-02-06 15:39:49 +00:00
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// LoadNotifyEmailWaters loads the publicreportWater's NotifyEmailWaters into the .R struct
|
|
|
|
|
func (os PublicreportWaterSlice) LoadNotifyEmailWaters(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
2026-02-06 15:39:49 +00:00
|
|
|
if len(os) == 0 {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
publicreportNotifyEmailWaters, err := os.NotifyEmailWaters(mods...).All(ctx, exec)
|
2026-02-06 15:39:49 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, o := range os {
|
|
|
|
|
if o == nil {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
o.R.NotifyEmailWaters = nil
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, o := range os {
|
|
|
|
|
if o == nil {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
for _, rel := range publicreportNotifyEmailWaters {
|
2026-02-06 15:39:49 +00:00
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
if !(o.ID == rel.WaterID) {
|
2026-02-06 15:39:49 +00:00
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
rel.R.Water = o
|
2026-02-06 15:39:49 +00:00
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
o.R.NotifyEmailWaters = append(o.R.NotifyEmailWaters, rel)
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// LoadNotifyPhoneWaters loads the publicreportWater's NotifyPhoneWaters into the .R struct
|
|
|
|
|
func (o *PublicreportWater) LoadNotifyPhoneWaters(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
2026-02-06 15:39:49 +00:00
|
|
|
if o == nil {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reset the relationship
|
2026-03-09 18:02:22 +00:00
|
|
|
o.R.NotifyPhoneWaters = nil
|
2026-02-06 15:39:49 +00:00
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
related, err := o.NotifyPhoneWaters(mods...).All(ctx, exec)
|
2026-02-06 15:39:49 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, rel := range related {
|
2026-03-09 18:02:22 +00:00
|
|
|
rel.R.Water = o
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
o.R.NotifyPhoneWaters = related
|
2026-02-06 15:39:49 +00:00
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// LoadNotifyPhoneWaters loads the publicreportWater's NotifyPhoneWaters into the .R struct
|
|
|
|
|
func (os PublicreportWaterSlice) LoadNotifyPhoneWaters(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
2026-02-06 15:39:49 +00:00
|
|
|
if len(os) == 0 {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
publicreportNotifyPhoneWaters, err := os.NotifyPhoneWaters(mods...).All(ctx, exec)
|
2026-02-06 15:39:49 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, o := range os {
|
|
|
|
|
if o == nil {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
o.R.NotifyPhoneWaters = nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, o := range os {
|
|
|
|
|
if o == nil {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, rel := range publicreportNotifyPhoneWaters {
|
|
|
|
|
|
|
|
|
|
if !(o.ID == rel.WaterID) {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rel.R.Water = o
|
|
|
|
|
|
|
|
|
|
o.R.NotifyPhoneWaters = append(o.R.NotifyPhoneWaters, rel)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// LoadAddress loads the publicreportWater's Address into the .R struct
|
|
|
|
|
func (o *PublicreportWater) LoadAddress(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
|
|
|
if o == nil {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reset the relationship
|
|
|
|
|
o.R.Address = nil
|
|
|
|
|
|
|
|
|
|
related, err := o.Address(mods...).One(ctx, exec)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
related.R.Waters = PublicreportWaterSlice{o}
|
|
|
|
|
|
|
|
|
|
o.R.Address = related
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// LoadAddress loads the publicreportWater's Address into the .R struct
|
|
|
|
|
func (os PublicreportWaterSlice) LoadAddress(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
|
|
|
if len(os) == 0 {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addresses, err := os.Address(mods...).All(ctx, exec)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, o := range os {
|
|
|
|
|
if o == nil {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
for _, rel := range addresses {
|
|
|
|
|
if !o.AddressID.IsValue() {
|
|
|
|
|
continue
|
|
|
|
|
}
|
2026-02-06 15:39:49 +00:00
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
if !(o.AddressID.IsValue() && o.AddressID.MustGet() == rel.ID) {
|
2026-02-06 15:39:49 +00:00
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
rel.R.Waters = append(rel.R.Waters, o)
|
2026-02-06 15:39:49 +00:00
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
o.R.Address = rel
|
|
|
|
|
break
|
2026-02-06 15:39:49 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// LoadOrganization loads the publicreportWater's Organization into the .R struct
|
|
|
|
|
func (o *PublicreportWater) LoadOrganization(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
2026-01-22 03:27:32 +00:00
|
|
|
if o == nil {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reset the relationship
|
|
|
|
|
o.R.Organization = nil
|
|
|
|
|
|
|
|
|
|
related, err := o.Organization(mods...).One(ctx, exec)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
related.R.Waters = PublicreportWaterSlice{o}
|
2026-01-22 03:27:32 +00:00
|
|
|
|
|
|
|
|
o.R.Organization = related
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// LoadOrganization loads the publicreportWater's Organization into the .R struct
|
|
|
|
|
func (os PublicreportWaterSlice) LoadOrganization(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
2026-01-22 03:27:32 +00:00
|
|
|
if len(os) == 0 {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
organizations, err := os.Organization(mods...).All(ctx, exec)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, o := range os {
|
|
|
|
|
if o == nil {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, rel := range organizations {
|
|
|
|
|
if !o.OrganizationID.IsValue() {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if !(o.OrganizationID.IsValue() && o.OrganizationID.MustGet() == rel.ID) {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
rel.R.Waters = append(rel.R.Waters, o)
|
2026-01-22 03:27:32 +00:00
|
|
|
|
|
|
|
|
o.R.Organization = rel
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// LoadImages loads the publicreportWater's Images into the .R struct
|
|
|
|
|
func (o *PublicreportWater) LoadImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
2026-01-09 19:43:19 +00:00
|
|
|
if o == nil {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reset the relationship
|
2026-01-16 14:52:11 +00:00
|
|
|
o.R.Images = nil
|
2026-01-09 19:43:19 +00:00
|
|
|
|
2026-01-16 14:52:11 +00:00
|
|
|
related, err := o.Images(mods...).All(ctx, exec)
|
2026-01-09 19:43:19 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, rel := range related {
|
2026-03-09 18:02:22 +00:00
|
|
|
rel.R.Waters = PublicreportWaterSlice{o}
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
2026-01-16 14:52:11 +00:00
|
|
|
o.R.Images = related
|
2026-01-09 19:43:19 +00:00
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
// LoadImages loads the publicreportWater's Images into the .R struct
|
|
|
|
|
func (os PublicreportWaterSlice) LoadImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
2026-01-09 19:43:19 +00:00
|
|
|
if len(os) == 0 {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-16 14:52:11 +00:00
|
|
|
// since we are changing the columns, we need to check if the original columns were set or add the defaults
|
|
|
|
|
sq := dialect.SelectQuery{}
|
|
|
|
|
for _, mod := range mods {
|
|
|
|
|
mod.Apply(&sq)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if len(sq.SelectList.Columns) == 0 {
|
|
|
|
|
mods = append(mods, sm.Columns(PublicreportImages.Columns))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
q := os.Images(append(
|
|
|
|
|
mods,
|
2026-03-09 18:02:22 +00:00
|
|
|
sm.Columns(PublicreportWaterImages.Columns.WaterID.As("related_publicreport.water.ID")),
|
2026-01-16 14:52:11 +00:00
|
|
|
)...)
|
|
|
|
|
|
|
|
|
|
IDSlice := []int32{}
|
|
|
|
|
|
|
|
|
|
mapper := scan.Mod(scan.StructMapper[*PublicreportImage](), func(ctx context.Context, cols []string) (scan.BeforeFunc, func(any, any) error) {
|
|
|
|
|
return func(row *scan.Row) (any, error) {
|
|
|
|
|
IDSlice = append(IDSlice, *new(int32))
|
2026-03-09 18:02:22 +00:00
|
|
|
row.ScheduleScanByName("related_publicreport.water.ID", &IDSlice[len(IDSlice)-1])
|
2026-01-16 14:52:11 +00:00
|
|
|
|
|
|
|
|
return nil, nil
|
|
|
|
|
},
|
|
|
|
|
func(any, any) error {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
publicreportImages, err := bob.Allx[bob.SliceTransformer[*PublicreportImage, PublicreportImageSlice]](ctx, exec, q, mapper)
|
2026-01-09 19:43:19 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, o := range os {
|
2026-01-16 14:52:11 +00:00
|
|
|
o.R.Images = nil
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, o := range os {
|
2026-01-16 14:52:11 +00:00
|
|
|
for i, rel := range publicreportImages {
|
|
|
|
|
if !(o.ID == IDSlice[i]) {
|
2026-01-09 19:43:19 +00:00
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 18:02:22 +00:00
|
|
|
rel.R.Waters = append(rel.R.Waters, o)
|
2026-01-09 19:43:19 +00:00
|
|
|
|
2026-01-16 14:52:11 +00:00
|
|
|
o.R.Images = append(o.R.Images, rel)
|
2026-01-09 19:43:19 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|