Finish green pool report submission
Also start the pattern of breaking out pool pages together in their own file. I think its easier to read this way.
This commit is contained in:
parent
9680fb6a68
commit
01ed2d6086
31 changed files with 5925 additions and 375 deletions
26
db/dberrors/publicreport.pool.bob.go
Normal file
26
db/dberrors/publicreport.pool.bob.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// Code generated by BobGen psql v0.0.4-0.20260105020634-53e08d840e47+dirty. DO NOT EDIT.
|
||||
// This file is meant to be re-generated in place and/or deleted at any time.
|
||||
|
||||
package dberrors
|
||||
|
||||
var PublicreportPoolErrors = &publicreportPoolErrors{
|
||||
ErrUniquePoolPkey: &UniqueConstraintError{
|
||||
schema: "publicreport",
|
||||
table: "pool",
|
||||
columns: []string{"id"},
|
||||
s: "pool_pkey",
|
||||
},
|
||||
|
||||
ErrUniquePoolPublicIdKey: &UniqueConstraintError{
|
||||
schema: "publicreport",
|
||||
table: "pool",
|
||||
columns: []string{"public_id"},
|
||||
s: "pool_public_id_key",
|
||||
},
|
||||
}
|
||||
|
||||
type publicreportPoolErrors struct {
|
||||
ErrUniquePoolPkey *UniqueConstraintError
|
||||
|
||||
ErrUniquePoolPublicIdKey *UniqueConstraintError
|
||||
}
|
||||
17
db/dberrors/publicreport.pool_photo.bob.go
Normal file
17
db/dberrors/publicreport.pool_photo.bob.go
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Code generated by BobGen psql v0.0.4-0.20260105020634-53e08d840e47+dirty. DO NOT EDIT.
|
||||
// This file is meant to be re-generated in place and/or deleted at any time.
|
||||
|
||||
package dberrors
|
||||
|
||||
var PublicreportPoolPhotoErrors = &publicreportPoolPhotoErrors{
|
||||
ErrUniquePoolPhotoPkey: &UniqueConstraintError{
|
||||
schema: "publicreport",
|
||||
table: "pool_photo",
|
||||
columns: []string{"id"},
|
||||
s: "pool_photo_pkey",
|
||||
},
|
||||
}
|
||||
|
||||
type publicreportPoolPhotoErrors struct {
|
||||
ErrUniquePoolPhotoPkey *UniqueConstraintError
|
||||
}
|
||||
402
db/dbinfo/publicreport.pool.bob.go
Normal file
402
db/dbinfo/publicreport.pool.bob.go
Normal file
|
|
@ -0,0 +1,402 @@
|
|||
// Code generated by BobGen psql v0.0.4-0.20260105020634-53e08d840e47+dirty. DO NOT EDIT.
|
||||
// This file is meant to be re-generated in place and/or deleted at any time.
|
||||
|
||||
package dbinfo
|
||||
|
||||
import "github.com/aarondl/opt/null"
|
||||
|
||||
var PublicreportPools = Table[
|
||||
publicreportPoolColumns,
|
||||
publicreportPoolIndexes,
|
||||
publicreportPoolForeignKeys,
|
||||
publicreportPoolUniques,
|
||||
publicreportPoolChecks,
|
||||
]{
|
||||
Schema: "publicreport",
|
||||
Name: "pool",
|
||||
Columns: publicreportPoolColumns{
|
||||
ID: column{
|
||||
Name: "id",
|
||||
DBType: "integer",
|
||||
Default: "nextval('publicreport.pool_id_seq'::regclass)",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AccessComments: column{
|
||||
Name: "access_comments",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AccessGate: column{
|
||||
Name: "access_gate",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AccessFence: column{
|
||||
Name: "access_fence",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AccessLocked: column{
|
||||
Name: "access_locked",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AccessDog: column{
|
||||
Name: "access_dog",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AccessOther: column{
|
||||
Name: "access_other",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Address: column{
|
||||
Name: "address",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AddressCountry: column{
|
||||
Name: "address_country",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AddressPostCode: column{
|
||||
Name: "address_post_code",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AddressPlace: column{
|
||||
Name: "address_place",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AddressStreet: column{
|
||||
Name: "address_street",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
AddressRegion: column{
|
||||
Name: "address_region",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Comments: column{
|
||||
Name: "comments",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Created: column{
|
||||
Name: "created",
|
||||
DBType: "timestamp without time zone",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
H3cell: column{
|
||||
Name: "h3cell",
|
||||
DBType: "h3index",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
HasAdult: column{
|
||||
Name: "has_adult",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
HasLarvae: column{
|
||||
Name: "has_larvae",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
HasPupae: column{
|
||||
Name: "has_pupae",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Location: column{
|
||||
Name: "location",
|
||||
DBType: "geography",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
MapZoom: column{
|
||||
Name: "map_zoom",
|
||||
DBType: "double precision",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
OwnerEmail: column{
|
||||
Name: "owner_email",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
OwnerName: column{
|
||||
Name: "owner_name",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
OwnerPhone: column{
|
||||
Name: "owner_phone",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
PublicID: column{
|
||||
Name: "public_id",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
ReporterEmail: column{
|
||||
Name: "reporter_email",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
ReporterName: column{
|
||||
Name: "reporter_name",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
ReporterPhone: column{
|
||||
Name: "reporter_phone",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Subscribe: column{
|
||||
Name: "subscribe",
|
||||
DBType: "boolean",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
},
|
||||
Indexes: publicreportPoolIndexes{
|
||||
PoolPkey: index{
|
||||
Type: "btree",
|
||||
Name: "pool_pkey",
|
||||
Columns: []indexColumn{
|
||||
{
|
||||
Name: "id",
|
||||
Desc: null.FromCond(false, true),
|
||||
IsExpression: false,
|
||||
},
|
||||
},
|
||||
Unique: true,
|
||||
Comment: "",
|
||||
NullsFirst: []bool{false},
|
||||
NullsDistinct: false,
|
||||
Where: "",
|
||||
Include: []string{},
|
||||
},
|
||||
PoolPublicIDKey: index{
|
||||
Type: "btree",
|
||||
Name: "pool_public_id_key",
|
||||
Columns: []indexColumn{
|
||||
{
|
||||
Name: "public_id",
|
||||
Desc: null.FromCond(false, true),
|
||||
IsExpression: false,
|
||||
},
|
||||
},
|
||||
Unique: true,
|
||||
Comment: "",
|
||||
NullsFirst: []bool{false},
|
||||
NullsDistinct: false,
|
||||
Where: "",
|
||||
Include: []string{},
|
||||
},
|
||||
},
|
||||
PrimaryKey: &constraint{
|
||||
Name: "pool_pkey",
|
||||
Columns: []string{"id"},
|
||||
Comment: "",
|
||||
},
|
||||
|
||||
Uniques: publicreportPoolUniques{
|
||||
PoolPublicIDKey: constraint{
|
||||
Name: "pool_public_id_key",
|
||||
Columns: []string{"public_id"},
|
||||
Comment: "",
|
||||
},
|
||||
},
|
||||
|
||||
Comment: "",
|
||||
}
|
||||
|
||||
type publicreportPoolColumns struct {
|
||||
ID column
|
||||
AccessComments column
|
||||
AccessGate column
|
||||
AccessFence column
|
||||
AccessLocked column
|
||||
AccessDog column
|
||||
AccessOther column
|
||||
Address column
|
||||
AddressCountry column
|
||||
AddressPostCode column
|
||||
AddressPlace column
|
||||
AddressStreet column
|
||||
AddressRegion column
|
||||
Comments column
|
||||
Created column
|
||||
H3cell column
|
||||
HasAdult column
|
||||
HasLarvae column
|
||||
HasPupae column
|
||||
Location column
|
||||
MapZoom column
|
||||
OwnerEmail column
|
||||
OwnerName column
|
||||
OwnerPhone column
|
||||
PublicID column
|
||||
ReporterEmail column
|
||||
ReporterName column
|
||||
ReporterPhone column
|
||||
Subscribe column
|
||||
}
|
||||
|
||||
func (c publicreportPoolColumns) AsSlice() []column {
|
||||
return []column{
|
||||
c.ID, c.AccessComments, c.AccessGate, c.AccessFence, c.AccessLocked, c.AccessDog, c.AccessOther, c.Address, c.AddressCountry, c.AddressPostCode, c.AddressPlace, c.AddressStreet, c.AddressRegion, c.Comments, c.Created, c.H3cell, c.HasAdult, c.HasLarvae, c.HasPupae, c.Location, c.MapZoom, c.OwnerEmail, c.OwnerName, c.OwnerPhone, c.PublicID, c.ReporterEmail, c.ReporterName, c.ReporterPhone, c.Subscribe,
|
||||
}
|
||||
}
|
||||
|
||||
type publicreportPoolIndexes struct {
|
||||
PoolPkey index
|
||||
PoolPublicIDKey index
|
||||
}
|
||||
|
||||
func (i publicreportPoolIndexes) AsSlice() []index {
|
||||
return []index{
|
||||
i.PoolPkey, i.PoolPublicIDKey,
|
||||
}
|
||||
}
|
||||
|
||||
type publicreportPoolForeignKeys struct{}
|
||||
|
||||
func (f publicreportPoolForeignKeys) AsSlice() []foreignKey {
|
||||
return []foreignKey{}
|
||||
}
|
||||
|
||||
type publicreportPoolUniques struct {
|
||||
PoolPublicIDKey constraint
|
||||
}
|
||||
|
||||
func (u publicreportPoolUniques) AsSlice() []constraint {
|
||||
return []constraint{
|
||||
u.PoolPublicIDKey,
|
||||
}
|
||||
}
|
||||
|
||||
type publicreportPoolChecks struct{}
|
||||
|
||||
func (c publicreportPoolChecks) AsSlice() []check {
|
||||
return []check{}
|
||||
}
|
||||
147
db/dbinfo/publicreport.pool_photo.bob.go
Normal file
147
db/dbinfo/publicreport.pool_photo.bob.go
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
// Code generated by BobGen psql v0.0.4-0.20260105020634-53e08d840e47+dirty. DO NOT EDIT.
|
||||
// This file is meant to be re-generated in place and/or deleted at any time.
|
||||
|
||||
package dbinfo
|
||||
|
||||
import "github.com/aarondl/opt/null"
|
||||
|
||||
var PublicreportPoolPhotos = Table[
|
||||
publicreportPoolPhotoColumns,
|
||||
publicreportPoolPhotoIndexes,
|
||||
publicreportPoolPhotoForeignKeys,
|
||||
publicreportPoolPhotoUniques,
|
||||
publicreportPoolPhotoChecks,
|
||||
]{
|
||||
Schema: "publicreport",
|
||||
Name: "pool_photo",
|
||||
Columns: publicreportPoolPhotoColumns{
|
||||
ID: column{
|
||||
Name: "id",
|
||||
DBType: "integer",
|
||||
Default: "nextval('publicreport.pool_photo_id_seq'::regclass)",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Size: column{
|
||||
Name: "size",
|
||||
DBType: "bigint",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Filename: column{
|
||||
Name: "filename",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
PoolID: column{
|
||||
Name: "pool_id",
|
||||
DBType: "integer",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
UUID: column{
|
||||
Name: "uuid",
|
||||
DBType: "uuid",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
},
|
||||
Indexes: publicreportPoolPhotoIndexes{
|
||||
PoolPhotoPkey: index{
|
||||
Type: "btree",
|
||||
Name: "pool_photo_pkey",
|
||||
Columns: []indexColumn{
|
||||
{
|
||||
Name: "id",
|
||||
Desc: null.FromCond(false, true),
|
||||
IsExpression: false,
|
||||
},
|
||||
},
|
||||
Unique: true,
|
||||
Comment: "",
|
||||
NullsFirst: []bool{false},
|
||||
NullsDistinct: false,
|
||||
Where: "",
|
||||
Include: []string{},
|
||||
},
|
||||
},
|
||||
PrimaryKey: &constraint{
|
||||
Name: "pool_photo_pkey",
|
||||
Columns: []string{"id"},
|
||||
Comment: "",
|
||||
},
|
||||
ForeignKeys: publicreportPoolPhotoForeignKeys{
|
||||
PublicreportPoolPhotoPoolPhotoPoolIDFkey: foreignKey{
|
||||
constraint: constraint{
|
||||
Name: "publicreport.pool_photo.pool_photo_pool_id_fkey",
|
||||
Columns: []string{"pool_id"},
|
||||
Comment: "",
|
||||
},
|
||||
ForeignTable: "publicreport.pool",
|
||||
ForeignColumns: []string{"id"},
|
||||
},
|
||||
},
|
||||
|
||||
Comment: "",
|
||||
}
|
||||
|
||||
type publicreportPoolPhotoColumns struct {
|
||||
ID column
|
||||
Size column
|
||||
Filename column
|
||||
PoolID column
|
||||
UUID column
|
||||
}
|
||||
|
||||
func (c publicreportPoolPhotoColumns) AsSlice() []column {
|
||||
return []column{
|
||||
c.ID, c.Size, c.Filename, c.PoolID, c.UUID,
|
||||
}
|
||||
}
|
||||
|
||||
type publicreportPoolPhotoIndexes struct {
|
||||
PoolPhotoPkey index
|
||||
}
|
||||
|
||||
func (i publicreportPoolPhotoIndexes) AsSlice() []index {
|
||||
return []index{
|
||||
i.PoolPhotoPkey,
|
||||
}
|
||||
}
|
||||
|
||||
type publicreportPoolPhotoForeignKeys struct {
|
||||
PublicreportPoolPhotoPoolPhotoPoolIDFkey foreignKey
|
||||
}
|
||||
|
||||
func (f publicreportPoolPhotoForeignKeys) AsSlice() []foreignKey {
|
||||
return []foreignKey{
|
||||
f.PublicreportPoolPhotoPoolPhotoPoolIDFkey,
|
||||
}
|
||||
}
|
||||
|
||||
type publicreportPoolPhotoUniques struct{}
|
||||
|
||||
func (u publicreportPoolPhotoUniques) AsSlice() []constraint {
|
||||
return []constraint{}
|
||||
}
|
||||
|
||||
type publicreportPoolPhotoChecks struct{}
|
||||
|
||||
func (c publicreportPoolPhotoChecks) AsSlice() []check {
|
||||
return []check{}
|
||||
}
|
||||
|
|
@ -890,3 +890,88 @@ func (e *PublicreportNuisancepreferredtimetype) Scan(value any) error {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Enum values for PublicreportPoolsourceduration
|
||||
const (
|
||||
PublicreportPoolsourcedurationNone PublicreportPoolsourceduration = "none"
|
||||
PublicreportPoolsourcedurationLessThanWeek PublicreportPoolsourceduration = "less-than-week"
|
||||
PublicreportPoolsourceduration12Weeks PublicreportPoolsourceduration = "1-2-weeks"
|
||||
PublicreportPoolsourceduration24Weeks PublicreportPoolsourceduration = "2-4-weeks"
|
||||
PublicreportPoolsourceduration13Months PublicreportPoolsourceduration = "1-3-months"
|
||||
PublicreportPoolsourcedurationMoreThan3Months PublicreportPoolsourceduration = "more-than-3-months"
|
||||
)
|
||||
|
||||
func AllPublicreportPoolsourceduration() []PublicreportPoolsourceduration {
|
||||
return []PublicreportPoolsourceduration{
|
||||
PublicreportPoolsourcedurationNone,
|
||||
PublicreportPoolsourcedurationLessThanWeek,
|
||||
PublicreportPoolsourceduration12Weeks,
|
||||
PublicreportPoolsourceduration24Weeks,
|
||||
PublicreportPoolsourceduration13Months,
|
||||
PublicreportPoolsourcedurationMoreThan3Months,
|
||||
}
|
||||
}
|
||||
|
||||
type PublicreportPoolsourceduration string
|
||||
|
||||
func (e PublicreportPoolsourceduration) String() string {
|
||||
return string(e)
|
||||
}
|
||||
|
||||
func (e PublicreportPoolsourceduration) Valid() bool {
|
||||
switch e {
|
||||
case PublicreportPoolsourcedurationNone,
|
||||
PublicreportPoolsourcedurationLessThanWeek,
|
||||
PublicreportPoolsourceduration12Weeks,
|
||||
PublicreportPoolsourceduration24Weeks,
|
||||
PublicreportPoolsourceduration13Months,
|
||||
PublicreportPoolsourcedurationMoreThan3Months:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// useful when testing in other packages
|
||||
func (e PublicreportPoolsourceduration) All() []PublicreportPoolsourceduration {
|
||||
return AllPublicreportPoolsourceduration()
|
||||
}
|
||||
|
||||
func (e PublicreportPoolsourceduration) MarshalText() ([]byte, error) {
|
||||
return []byte(e), nil
|
||||
}
|
||||
|
||||
func (e *PublicreportPoolsourceduration) UnmarshalText(text []byte) error {
|
||||
return e.Scan(text)
|
||||
}
|
||||
|
||||
func (e PublicreportPoolsourceduration) MarshalBinary() ([]byte, error) {
|
||||
return []byte(e), nil
|
||||
}
|
||||
|
||||
func (e *PublicreportPoolsourceduration) UnmarshalBinary(data []byte) error {
|
||||
return e.Scan(data)
|
||||
}
|
||||
|
||||
func (e PublicreportPoolsourceduration) Value() (driver.Value, error) {
|
||||
return string(e), nil
|
||||
}
|
||||
|
||||
func (e *PublicreportPoolsourceduration) Scan(value any) error {
|
||||
switch x := value.(type) {
|
||||
case string:
|
||||
*e = PublicreportPoolsourceduration(x)
|
||||
case []byte:
|
||||
*e = PublicreportPoolsourceduration(x)
|
||||
case nil:
|
||||
return fmt.Errorf("cannot nil into PublicreportPoolsourceduration")
|
||||
default:
|
||||
return fmt.Errorf("cannot scan type %T: %v", value, value)
|
||||
}
|
||||
|
||||
if !e.Valid() {
|
||||
return fmt.Errorf("invalid PublicreportPoolsourceduration value: %s", *e)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,6 +211,14 @@ var (
|
|||
// Relationship Contexts for publicreport.nuisance
|
||||
publicreportNuisanceWithParentsCascadingCtx = newContextual[bool]("publicreportNuisanceWithParentsCascading")
|
||||
|
||||
// Relationship Contexts for publicreport.pool
|
||||
publicreportPoolWithParentsCascadingCtx = newContextual[bool]("publicreportPoolWithParentsCascading")
|
||||
publicreportPoolRelPoolPhotosCtx = newContextual[bool]("publicreport.pool.publicreport.pool_photo.publicreport.pool_photo.pool_photo_pool_id_fkey")
|
||||
|
||||
// Relationship Contexts for publicreport.pool_photo
|
||||
publicreportPoolPhotoWithParentsCascadingCtx = newContextual[bool]("publicreportPoolPhotoWithParentsCascading")
|
||||
publicreportPoolPhotoRelPoolCtx = newContextual[bool]("publicreport.pool.publicreport.pool_photo.publicreport.pool_photo.pool_photo_pool_id_fkey")
|
||||
|
||||
// Relationship Contexts for publicreport.quick
|
||||
publicreportQuickWithParentsCascadingCtx = newContextual[bool]("publicreportQuickWithParentsCascading")
|
||||
publicreportQuickRelQuickPhotosCtx = newContextual[bool]("publicreport.quick.publicreport.quick_photo.publicreport.quick_photo.quick_photo_quick_id_fkey")
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ type Factory struct {
|
|||
baseOauthTokenMods OauthTokenModSlice
|
||||
baseOrganizationMods OrganizationModSlice
|
||||
basePublicreportNuisanceMods PublicreportNuisanceModSlice
|
||||
basePublicreportPoolMods PublicreportPoolModSlice
|
||||
basePublicreportPoolPhotoMods PublicreportPoolPhotoModSlice
|
||||
basePublicreportQuickMods PublicreportQuickModSlice
|
||||
basePublicreportQuickPhotoMods PublicreportQuickPhotoModSlice
|
||||
baseRasterColumnMods RasterColumnModSlice
|
||||
|
|
@ -2420,6 +2422,96 @@ func (f *Factory) FromExistingPublicreportNuisance(m *models.PublicreportNuisanc
|
|||
return o
|
||||
}
|
||||
|
||||
func (f *Factory) NewPublicreportPool(mods ...PublicreportPoolMod) *PublicreportPoolTemplate {
|
||||
return f.NewPublicreportPoolWithContext(context.Background(), mods...)
|
||||
}
|
||||
|
||||
func (f *Factory) NewPublicreportPoolWithContext(ctx context.Context, mods ...PublicreportPoolMod) *PublicreportPoolTemplate {
|
||||
o := &PublicreportPoolTemplate{f: f}
|
||||
|
||||
if f != nil {
|
||||
f.basePublicreportPoolMods.Apply(ctx, o)
|
||||
}
|
||||
|
||||
PublicreportPoolModSlice(mods).Apply(ctx, o)
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
func (f *Factory) FromExistingPublicreportPool(m *models.PublicreportPool) *PublicreportPoolTemplate {
|
||||
o := &PublicreportPoolTemplate{f: f, alreadyPersisted: true}
|
||||
|
||||
o.ID = func() int32 { return m.ID }
|
||||
o.AccessComments = func() string { return m.AccessComments }
|
||||
o.AccessGate = func() bool { return m.AccessGate }
|
||||
o.AccessFence = func() bool { return m.AccessFence }
|
||||
o.AccessLocked = func() bool { return m.AccessLocked }
|
||||
o.AccessDog = func() bool { return m.AccessDog }
|
||||
o.AccessOther = func() bool { return m.AccessOther }
|
||||
o.Address = func() string { return m.Address }
|
||||
o.AddressCountry = func() string { return m.AddressCountry }
|
||||
o.AddressPostCode = func() string { return m.AddressPostCode }
|
||||
o.AddressPlace = func() string { return m.AddressPlace }
|
||||
o.AddressStreet = func() string { return m.AddressStreet }
|
||||
o.AddressRegion = func() string { return m.AddressRegion }
|
||||
o.Comments = func() string { return m.Comments }
|
||||
o.Created = func() time.Time { return m.Created }
|
||||
o.H3cell = func() null.Val[string] { return m.H3cell }
|
||||
o.HasAdult = func() bool { return m.HasAdult }
|
||||
o.HasLarvae = func() bool { return m.HasLarvae }
|
||||
o.HasPupae = func() bool { return m.HasPupae }
|
||||
o.Location = func() null.Val[string] { return m.Location }
|
||||
o.MapZoom = func() float64 { return m.MapZoom }
|
||||
o.OwnerEmail = func() string { return m.OwnerEmail }
|
||||
o.OwnerName = func() string { return m.OwnerName }
|
||||
o.OwnerPhone = func() string { return m.OwnerPhone }
|
||||
o.PublicID = func() string { return m.PublicID }
|
||||
o.ReporterEmail = func() string { return m.ReporterEmail }
|
||||
o.ReporterName = func() string { return m.ReporterName }
|
||||
o.ReporterPhone = func() string { return m.ReporterPhone }
|
||||
o.Subscribe = func() bool { return m.Subscribe }
|
||||
|
||||
ctx := context.Background()
|
||||
if len(m.R.PoolPhotos) > 0 {
|
||||
PublicreportPoolMods.AddExistingPoolPhotos(m.R.PoolPhotos...).Apply(ctx, o)
|
||||
}
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
func (f *Factory) NewPublicreportPoolPhoto(mods ...PublicreportPoolPhotoMod) *PublicreportPoolPhotoTemplate {
|
||||
return f.NewPublicreportPoolPhotoWithContext(context.Background(), mods...)
|
||||
}
|
||||
|
||||
func (f *Factory) NewPublicreportPoolPhotoWithContext(ctx context.Context, mods ...PublicreportPoolPhotoMod) *PublicreportPoolPhotoTemplate {
|
||||
o := &PublicreportPoolPhotoTemplate{f: f}
|
||||
|
||||
if f != nil {
|
||||
f.basePublicreportPoolPhotoMods.Apply(ctx, o)
|
||||
}
|
||||
|
||||
PublicreportPoolPhotoModSlice(mods).Apply(ctx, o)
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
func (f *Factory) FromExistingPublicreportPoolPhoto(m *models.PublicreportPoolPhoto) *PublicreportPoolPhotoTemplate {
|
||||
o := &PublicreportPoolPhotoTemplate{f: f, alreadyPersisted: true}
|
||||
|
||||
o.ID = func() int32 { return m.ID }
|
||||
o.Size = func() int64 { return m.Size }
|
||||
o.Filename = func() string { return m.Filename }
|
||||
o.PoolID = func() int32 { return m.PoolID }
|
||||
o.UUID = func() uuid.UUID { return m.UUID }
|
||||
|
||||
ctx := context.Background()
|
||||
if m.R.Pool != nil {
|
||||
PublicreportPoolPhotoMods.WithExistingPool(m.R.Pool).Apply(ctx, o)
|
||||
}
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
func (f *Factory) NewPublicreportQuick(mods ...PublicreportQuickMod) *PublicreportQuickTemplate {
|
||||
return f.NewPublicreportQuickWithContext(context.Background(), mods...)
|
||||
}
|
||||
|
|
@ -3009,6 +3101,22 @@ func (f *Factory) AddBasePublicreportNuisanceMod(mods ...PublicreportNuisanceMod
|
|||
f.basePublicreportNuisanceMods = append(f.basePublicreportNuisanceMods, mods...)
|
||||
}
|
||||
|
||||
func (f *Factory) ClearBasePublicreportPoolMods() {
|
||||
f.basePublicreportPoolMods = nil
|
||||
}
|
||||
|
||||
func (f *Factory) AddBasePublicreportPoolMod(mods ...PublicreportPoolMod) {
|
||||
f.basePublicreportPoolMods = append(f.basePublicreportPoolMods, mods...)
|
||||
}
|
||||
|
||||
func (f *Factory) ClearBasePublicreportPoolPhotoMods() {
|
||||
f.basePublicreportPoolPhotoMods = nil
|
||||
}
|
||||
|
||||
func (f *Factory) AddBasePublicreportPoolPhotoMod(mods ...PublicreportPoolPhotoMod) {
|
||||
f.basePublicreportPoolPhotoMods = append(f.basePublicreportPoolPhotoMods, mods...)
|
||||
}
|
||||
|
||||
func (f *Factory) ClearBasePublicreportQuickMods() {
|
||||
f.basePublicreportQuickMods = nil
|
||||
}
|
||||
|
|
|
|||
1613
db/factory/publicreport.pool.bob.go
Normal file
1613
db/factory/publicreport.pool.bob.go
Normal file
File diff suppressed because it is too large
Load diff
498
db/factory/publicreport.pool_photo.bob.go
Normal file
498
db/factory/publicreport.pool_photo.bob.go
Normal file
|
|
@ -0,0 +1,498 @@
|
|||
// Code generated by BobGen psql v0.0.4-0.20260105020634-53e08d840e47+dirty. DO NOT EDIT.
|
||||
// This file is meant to be re-generated in place and/or deleted at any time.
|
||||
|
||||
package factory
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
models "github.com/Gleipnir-Technology/nidus-sync/db/models"
|
||||
"github.com/aarondl/opt/omit"
|
||||
"github.com/google/uuid"
|
||||
"github.com/jaswdr/faker/v2"
|
||||
"github.com/stephenafamo/bob"
|
||||
)
|
||||
|
||||
type PublicreportPoolPhotoMod interface {
|
||||
Apply(context.Context, *PublicreportPoolPhotoTemplate)
|
||||
}
|
||||
|
||||
type PublicreportPoolPhotoModFunc func(context.Context, *PublicreportPoolPhotoTemplate)
|
||||
|
||||
func (f PublicreportPoolPhotoModFunc) Apply(ctx context.Context, n *PublicreportPoolPhotoTemplate) {
|
||||
f(ctx, n)
|
||||
}
|
||||
|
||||
type PublicreportPoolPhotoModSlice []PublicreportPoolPhotoMod
|
||||
|
||||
func (mods PublicreportPoolPhotoModSlice) Apply(ctx context.Context, n *PublicreportPoolPhotoTemplate) {
|
||||
for _, f := range mods {
|
||||
f.Apply(ctx, n)
|
||||
}
|
||||
}
|
||||
|
||||
// PublicreportPoolPhotoTemplate is an object representing the database table.
|
||||
// all columns are optional and should be set by mods
|
||||
type PublicreportPoolPhotoTemplate struct {
|
||||
ID func() int32
|
||||
Size func() int64
|
||||
Filename func() string
|
||||
PoolID func() int32
|
||||
UUID func() uuid.UUID
|
||||
|
||||
r publicreportPoolPhotoR
|
||||
f *Factory
|
||||
|
||||
alreadyPersisted bool
|
||||
}
|
||||
|
||||
type publicreportPoolPhotoR struct {
|
||||
Pool *publicreportPoolPhotoRPoolR
|
||||
}
|
||||
|
||||
type publicreportPoolPhotoRPoolR struct {
|
||||
o *PublicreportPoolTemplate
|
||||
}
|
||||
|
||||
// Apply mods to the PublicreportPoolPhotoTemplate
|
||||
func (o *PublicreportPoolPhotoTemplate) Apply(ctx context.Context, mods ...PublicreportPoolPhotoMod) {
|
||||
for _, mod := range mods {
|
||||
mod.Apply(ctx, o)
|
||||
}
|
||||
}
|
||||
|
||||
// setModelRels creates and sets the relationships on *models.PublicreportPoolPhoto
|
||||
// according to the relationships in the template. Nothing is inserted into the db
|
||||
func (t PublicreportPoolPhotoTemplate) setModelRels(o *models.PublicreportPoolPhoto) {
|
||||
if t.r.Pool != nil {
|
||||
rel := t.r.Pool.o.Build()
|
||||
rel.R.PoolPhotos = append(rel.R.PoolPhotos, o)
|
||||
o.PoolID = rel.ID // h2
|
||||
o.R.Pool = rel
|
||||
}
|
||||
}
|
||||
|
||||
// BuildSetter returns an *models.PublicreportPoolPhotoSetter
|
||||
// this does nothing with the relationship templates
|
||||
func (o PublicreportPoolPhotoTemplate) BuildSetter() *models.PublicreportPoolPhotoSetter {
|
||||
m := &models.PublicreportPoolPhotoSetter{}
|
||||
|
||||
if o.ID != nil {
|
||||
val := o.ID()
|
||||
m.ID = omit.From(val)
|
||||
}
|
||||
if o.Size != nil {
|
||||
val := o.Size()
|
||||
m.Size = omit.From(val)
|
||||
}
|
||||
if o.Filename != nil {
|
||||
val := o.Filename()
|
||||
m.Filename = omit.From(val)
|
||||
}
|
||||
if o.PoolID != nil {
|
||||
val := o.PoolID()
|
||||
m.PoolID = omit.From(val)
|
||||
}
|
||||
if o.UUID != nil {
|
||||
val := o.UUID()
|
||||
m.UUID = omit.From(val)
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
// BuildManySetter returns an []*models.PublicreportPoolPhotoSetter
|
||||
// this does nothing with the relationship templates
|
||||
func (o PublicreportPoolPhotoTemplate) BuildManySetter(number int) []*models.PublicreportPoolPhotoSetter {
|
||||
m := make([]*models.PublicreportPoolPhotoSetter, number)
|
||||
|
||||
for i := range m {
|
||||
m[i] = o.BuildSetter()
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
// Build returns an *models.PublicreportPoolPhoto
|
||||
// Related objects are also created and placed in the .R field
|
||||
// NOTE: Objects are not inserted into the database. Use PublicreportPoolPhotoTemplate.Create
|
||||
func (o PublicreportPoolPhotoTemplate) Build() *models.PublicreportPoolPhoto {
|
||||
m := &models.PublicreportPoolPhoto{}
|
||||
|
||||
if o.ID != nil {
|
||||
m.ID = o.ID()
|
||||
}
|
||||
if o.Size != nil {
|
||||
m.Size = o.Size()
|
||||
}
|
||||
if o.Filename != nil {
|
||||
m.Filename = o.Filename()
|
||||
}
|
||||
if o.PoolID != nil {
|
||||
m.PoolID = o.PoolID()
|
||||
}
|
||||
if o.UUID != nil {
|
||||
m.UUID = o.UUID()
|
||||
}
|
||||
|
||||
o.setModelRels(m)
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
// BuildMany returns an models.PublicreportPoolPhotoSlice
|
||||
// Related objects are also created and placed in the .R field
|
||||
// NOTE: Objects are not inserted into the database. Use PublicreportPoolPhotoTemplate.CreateMany
|
||||
func (o PublicreportPoolPhotoTemplate) BuildMany(number int) models.PublicreportPoolPhotoSlice {
|
||||
m := make(models.PublicreportPoolPhotoSlice, number)
|
||||
|
||||
for i := range m {
|
||||
m[i] = o.Build()
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
func ensureCreatablePublicreportPoolPhoto(m *models.PublicreportPoolPhotoSetter) {
|
||||
if !(m.Size.IsValue()) {
|
||||
val := random_int64(nil)
|
||||
m.Size = omit.From(val)
|
||||
}
|
||||
if !(m.Filename.IsValue()) {
|
||||
val := random_string(nil)
|
||||
m.Filename = omit.From(val)
|
||||
}
|
||||
if !(m.PoolID.IsValue()) {
|
||||
val := random_int32(nil)
|
||||
m.PoolID = omit.From(val)
|
||||
}
|
||||
if !(m.UUID.IsValue()) {
|
||||
val := random_uuid_UUID(nil)
|
||||
m.UUID = omit.From(val)
|
||||
}
|
||||
}
|
||||
|
||||
// insertOptRels creates and inserts any optional the relationships on *models.PublicreportPoolPhoto
|
||||
// according to the relationships in the template.
|
||||
// any required relationship should have already exist on the model
|
||||
func (o *PublicreportPoolPhotoTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.PublicreportPoolPhoto) error {
|
||||
var err error
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// Create builds a publicreportPoolPhoto and inserts it into the database
|
||||
// Relations objects are also inserted and placed in the .R field
|
||||
func (o *PublicreportPoolPhotoTemplate) Create(ctx context.Context, exec bob.Executor) (*models.PublicreportPoolPhoto, error) {
|
||||
var err error
|
||||
opt := o.BuildSetter()
|
||||
ensureCreatablePublicreportPoolPhoto(opt)
|
||||
|
||||
if o.r.Pool == nil {
|
||||
PublicreportPoolPhotoMods.WithNewPool().Apply(ctx, o)
|
||||
}
|
||||
|
||||
var rel0 *models.PublicreportPool
|
||||
|
||||
if o.r.Pool.o.alreadyPersisted {
|
||||
rel0 = o.r.Pool.o.Build()
|
||||
} else {
|
||||
rel0, err = o.r.Pool.o.Create(ctx, exec)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
opt.PoolID = omit.From(rel0.ID)
|
||||
|
||||
m, err := models.PublicreportPoolPhotos.Insert(opt).One(ctx, exec)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
m.R.Pool = rel0
|
||||
|
||||
if err := o.insertOptRels(ctx, exec, m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, err
|
||||
}
|
||||
|
||||
// MustCreate builds a publicreportPoolPhoto and inserts it into the database
|
||||
// Relations objects are also inserted and placed in the .R field
|
||||
// panics if an error occurs
|
||||
func (o *PublicreportPoolPhotoTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.PublicreportPoolPhoto {
|
||||
m, err := o.Create(ctx, exec)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// CreateOrFail builds a publicreportPoolPhoto and inserts it into the database
|
||||
// Relations objects are also inserted and placed in the .R field
|
||||
// It calls `tb.Fatal(err)` on the test/benchmark if an error occurs
|
||||
func (o *PublicreportPoolPhotoTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.PublicreportPoolPhoto {
|
||||
tb.Helper()
|
||||
m, err := o.Create(ctx, exec)
|
||||
if err != nil {
|
||||
tb.Fatal(err)
|
||||
return nil
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// CreateMany builds multiple publicreportPoolPhotos and inserts them into the database
|
||||
// Relations objects are also inserted and placed in the .R field
|
||||
func (o PublicreportPoolPhotoTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.PublicreportPoolPhotoSlice, error) {
|
||||
var err error
|
||||
m := make(models.PublicreportPoolPhotoSlice, number)
|
||||
|
||||
for i := range m {
|
||||
m[i], err = o.Create(ctx, exec)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// MustCreateMany builds multiple publicreportPoolPhotos and inserts them into the database
|
||||
// Relations objects are also inserted and placed in the .R field
|
||||
// panics if an error occurs
|
||||
func (o PublicreportPoolPhotoTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.PublicreportPoolPhotoSlice {
|
||||
m, err := o.CreateMany(ctx, exec, number)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// CreateManyOrFail builds multiple publicreportPoolPhotos and inserts them into the database
|
||||
// Relations objects are also inserted and placed in the .R field
|
||||
// It calls `tb.Fatal(err)` on the test/benchmark if an error occurs
|
||||
func (o PublicreportPoolPhotoTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.PublicreportPoolPhotoSlice {
|
||||
tb.Helper()
|
||||
m, err := o.CreateMany(ctx, exec, number)
|
||||
if err != nil {
|
||||
tb.Fatal(err)
|
||||
return nil
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
// PublicreportPoolPhoto has methods that act as mods for the PublicreportPoolPhotoTemplate
|
||||
var PublicreportPoolPhotoMods publicreportPoolPhotoMods
|
||||
|
||||
type publicreportPoolPhotoMods struct{}
|
||||
|
||||
func (m publicreportPoolPhotoMods) RandomizeAllColumns(f *faker.Faker) PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModSlice{
|
||||
PublicreportPoolPhotoMods.RandomID(f),
|
||||
PublicreportPoolPhotoMods.RandomSize(f),
|
||||
PublicreportPoolPhotoMods.RandomFilename(f),
|
||||
PublicreportPoolPhotoMods.RandomPoolID(f),
|
||||
PublicreportPoolPhotoMods.RandomUUID(f),
|
||||
}
|
||||
}
|
||||
|
||||
// Set the model columns to this value
|
||||
func (m publicreportPoolPhotoMods) ID(val int32) PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.ID = func() int32 { return val }
|
||||
})
|
||||
}
|
||||
|
||||
// Set the Column from the function
|
||||
func (m publicreportPoolPhotoMods) IDFunc(f func() int32) PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.ID = f
|
||||
})
|
||||
}
|
||||
|
||||
// Clear any values for the column
|
||||
func (m publicreportPoolPhotoMods) UnsetID() PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.ID = nil
|
||||
})
|
||||
}
|
||||
|
||||
// Generates a random value for the column using the given faker
|
||||
// if faker is nil, a default faker is used
|
||||
func (m publicreportPoolPhotoMods) RandomID(f *faker.Faker) PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.ID = func() int32 {
|
||||
return random_int32(f)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Set the model columns to this value
|
||||
func (m publicreportPoolPhotoMods) Size(val int64) PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.Size = func() int64 { return val }
|
||||
})
|
||||
}
|
||||
|
||||
// Set the Column from the function
|
||||
func (m publicreportPoolPhotoMods) SizeFunc(f func() int64) PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.Size = f
|
||||
})
|
||||
}
|
||||
|
||||
// Clear any values for the column
|
||||
func (m publicreportPoolPhotoMods) UnsetSize() PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.Size = nil
|
||||
})
|
||||
}
|
||||
|
||||
// Generates a random value for the column using the given faker
|
||||
// if faker is nil, a default faker is used
|
||||
func (m publicreportPoolPhotoMods) RandomSize(f *faker.Faker) PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.Size = func() int64 {
|
||||
return random_int64(f)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Set the model columns to this value
|
||||
func (m publicreportPoolPhotoMods) Filename(val string) PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.Filename = func() string { return val }
|
||||
})
|
||||
}
|
||||
|
||||
// Set the Column from the function
|
||||
func (m publicreportPoolPhotoMods) FilenameFunc(f func() string) PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.Filename = f
|
||||
})
|
||||
}
|
||||
|
||||
// Clear any values for the column
|
||||
func (m publicreportPoolPhotoMods) UnsetFilename() PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.Filename = nil
|
||||
})
|
||||
}
|
||||
|
||||
// Generates a random value for the column using the given faker
|
||||
// if faker is nil, a default faker is used
|
||||
func (m publicreportPoolPhotoMods) RandomFilename(f *faker.Faker) PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.Filename = func() string {
|
||||
return random_string(f)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Set the model columns to this value
|
||||
func (m publicreportPoolPhotoMods) PoolID(val int32) PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.PoolID = func() int32 { return val }
|
||||
})
|
||||
}
|
||||
|
||||
// Set the Column from the function
|
||||
func (m publicreportPoolPhotoMods) PoolIDFunc(f func() int32) PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.PoolID = f
|
||||
})
|
||||
}
|
||||
|
||||
// Clear any values for the column
|
||||
func (m publicreportPoolPhotoMods) UnsetPoolID() PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.PoolID = nil
|
||||
})
|
||||
}
|
||||
|
||||
// Generates a random value for the column using the given faker
|
||||
// if faker is nil, a default faker is used
|
||||
func (m publicreportPoolPhotoMods) RandomPoolID(f *faker.Faker) PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.PoolID = func() int32 {
|
||||
return random_int32(f)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Set the model columns to this value
|
||||
func (m publicreportPoolPhotoMods) UUID(val uuid.UUID) PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.UUID = func() uuid.UUID { return val }
|
||||
})
|
||||
}
|
||||
|
||||
// Set the Column from the function
|
||||
func (m publicreportPoolPhotoMods) UUIDFunc(f func() uuid.UUID) PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.UUID = f
|
||||
})
|
||||
}
|
||||
|
||||
// Clear any values for the column
|
||||
func (m publicreportPoolPhotoMods) UnsetUUID() PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.UUID = nil
|
||||
})
|
||||
}
|
||||
|
||||
// Generates a random value for the column using the given faker
|
||||
// if faker is nil, a default faker is used
|
||||
func (m publicreportPoolPhotoMods) RandomUUID(f *faker.Faker) PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(_ context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.UUID = func() uuid.UUID {
|
||||
return random_uuid_UUID(f)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (m publicreportPoolPhotoMods) WithParentsCascading() PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(ctx context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
if isDone, _ := publicreportPoolPhotoWithParentsCascadingCtx.Value(ctx); isDone {
|
||||
return
|
||||
}
|
||||
ctx = publicreportPoolPhotoWithParentsCascadingCtx.WithValue(ctx, true)
|
||||
{
|
||||
|
||||
related := o.f.NewPublicreportPoolWithContext(ctx, PublicreportPoolMods.WithParentsCascading())
|
||||
m.WithPool(related).Apply(ctx, o)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (m publicreportPoolPhotoMods) WithPool(rel *PublicreportPoolTemplate) PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(ctx context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.r.Pool = &publicreportPoolPhotoRPoolR{
|
||||
o: rel,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (m publicreportPoolPhotoMods) WithNewPool(mods ...PublicreportPoolMod) PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(ctx context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
related := o.f.NewPublicreportPoolWithContext(ctx, mods...)
|
||||
|
||||
m.WithPool(related).Apply(ctx, o)
|
||||
})
|
||||
}
|
||||
|
||||
func (m publicreportPoolPhotoMods) WithExistingPool(em *models.PublicreportPool) PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(ctx context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.r.Pool = &publicreportPoolPhotoRPoolR{
|
||||
o: o.f.FromExistingPublicreportPool(em),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (m publicreportPoolPhotoMods) WithoutPool() PublicreportPoolPhotoMod {
|
||||
return PublicreportPoolPhotoModFunc(func(ctx context.Context, o *PublicreportPoolPhotoTemplate) {
|
||||
o.r.Pool = nil
|
||||
})
|
||||
}
|
||||
53
db/migrations/00026_publicreport_pool.sql
Normal file
53
db/migrations/00026_publicreport_pool.sql
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
-- +goose Up
|
||||
CREATE TYPE publicreport.PoolSourceDuration AS ENUM (
|
||||
'none',
|
||||
'less-than-week',
|
||||
'1-2-weeks',
|
||||
'2-4-weeks',
|
||||
'1-3-months',
|
||||
'more-than-3-months'
|
||||
);
|
||||
CREATE TABLE publicreport.pool (
|
||||
id SERIAL PRIMARY KEY,
|
||||
access_comments TEXT NOT NULL,
|
||||
access_gate BOOLEAN NOT NULL,
|
||||
access_fence BOOLEAN NOT NULL,
|
||||
access_locked BOOLEAN NOT NULL,
|
||||
access_dog BOOLEAN NOT NULL,
|
||||
access_other BOOLEAN NOT NULL,
|
||||
address TEXT NOT NULL,
|
||||
address_country TEXT NOT NULL,
|
||||
address_post_code TEXT NOT NULL,
|
||||
address_place TEXT NOT NULL,
|
||||
address_street TEXT NOT NULL,
|
||||
address_region TEXT NOT NULL,
|
||||
comments TEXT NOT NULL,
|
||||
created TIMESTAMP WITHOUT TIME ZONE NOT NULL,
|
||||
h3cell h3index,
|
||||
has_adult BOOLEAN NOT NULL,
|
||||
has_larvae BOOLEAN NOT NULL,
|
||||
has_pupae BOOLEAN NOT NULL,
|
||||
location GEOGRAPHY,
|
||||
map_zoom FLOAT NOT NULL,
|
||||
owner_email TEXT NOT NULL,
|
||||
owner_name TEXT NOT NULL,
|
||||
owner_phone TEXT NOT NULL,
|
||||
public_id TEXT NOT NULL UNIQUE,
|
||||
reporter_email TEXT NOT NULL,
|
||||
reporter_name TEXT NOT NULL,
|
||||
reporter_phone TEXT NOT NULL,
|
||||
subscribe BOOLEAN NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE publicreport.pool_photo (
|
||||
id SERIAL PRIMARY KEY,
|
||||
size BIGINT NOT NULL,
|
||||
filename TEXT NOT NULL,
|
||||
pool_id INT NOT NULL REFERENCES publicreport.pool(id),
|
||||
uuid UUID NOT NULL
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE publicreport.pool_photo;
|
||||
DROP TABLE publicreport.pool;
|
||||
DROP TYPE publicreport.PoolSourceDuration;
|
||||
|
|
@ -70,6 +70,8 @@ type joins[Q dialect.Joinable] struct {
|
|||
Notifications joinSet[notificationJoins[Q]]
|
||||
OauthTokens joinSet[oauthTokenJoins[Q]]
|
||||
Organizations joinSet[organizationJoins[Q]]
|
||||
PublicreportPools joinSet[publicreportPoolJoins[Q]]
|
||||
PublicreportPoolPhotos joinSet[publicreportPoolPhotoJoins[Q]]
|
||||
PublicreportQuicks joinSet[publicreportQuickJoins[Q]]
|
||||
PublicreportQuickPhotos joinSet[publicreportQuickPhotoJoins[Q]]
|
||||
Users joinSet[userJoins[Q]]
|
||||
|
|
@ -123,6 +125,8 @@ func getJoins[Q dialect.Joinable]() joins[Q] {
|
|||
Notifications: buildJoinSet[notificationJoins[Q]](Notifications.Columns, buildNotificationJoins),
|
||||
OauthTokens: buildJoinSet[oauthTokenJoins[Q]](OauthTokens.Columns, buildOauthTokenJoins),
|
||||
Organizations: buildJoinSet[organizationJoins[Q]](Organizations.Columns, buildOrganizationJoins),
|
||||
PublicreportPools: buildJoinSet[publicreportPoolJoins[Q]](PublicreportPools.Columns, buildPublicreportPoolJoins),
|
||||
PublicreportPoolPhotos: buildJoinSet[publicreportPoolPhotoJoins[Q]](PublicreportPoolPhotos.Columns, buildPublicreportPoolPhotoJoins),
|
||||
PublicreportQuicks: buildJoinSet[publicreportQuickJoins[Q]](PublicreportQuicks.Columns, buildPublicreportQuickJoins),
|
||||
PublicreportQuickPhotos: buildJoinSet[publicreportQuickPhotoJoins[Q]](PublicreportQuickPhotos.Columns, buildPublicreportQuickPhotoJoins),
|
||||
Users: buildJoinSet[userJoins[Q]](Users.Columns, buildUserJoins),
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ type preloaders struct {
|
|||
Notification notificationPreloader
|
||||
OauthToken oauthTokenPreloader
|
||||
Organization organizationPreloader
|
||||
PublicreportPool publicreportPoolPreloader
|
||||
PublicreportPoolPhoto publicreportPoolPhotoPreloader
|
||||
PublicreportQuick publicreportQuickPreloader
|
||||
PublicreportQuickPhoto publicreportQuickPhotoPreloader
|
||||
User userPreloader
|
||||
|
|
@ -100,6 +102,8 @@ func getPreloaders() preloaders {
|
|||
Notification: buildNotificationPreloader(),
|
||||
OauthToken: buildOauthTokenPreloader(),
|
||||
Organization: buildOrganizationPreloader(),
|
||||
PublicreportPool: buildPublicreportPoolPreloader(),
|
||||
PublicreportPoolPhoto: buildPublicreportPoolPhotoPreloader(),
|
||||
PublicreportQuick: buildPublicreportQuickPreloader(),
|
||||
PublicreportQuickPhoto: buildPublicreportQuickPhotoPreloader(),
|
||||
User: buildUserPreloader(),
|
||||
|
|
@ -151,6 +155,8 @@ type thenLoaders[Q orm.Loadable] struct {
|
|||
Notification notificationThenLoader[Q]
|
||||
OauthToken oauthTokenThenLoader[Q]
|
||||
Organization organizationThenLoader[Q]
|
||||
PublicreportPool publicreportPoolThenLoader[Q]
|
||||
PublicreportPoolPhoto publicreportPoolPhotoThenLoader[Q]
|
||||
PublicreportQuick publicreportQuickThenLoader[Q]
|
||||
PublicreportQuickPhoto publicreportQuickPhotoThenLoader[Q]
|
||||
User userThenLoader[Q]
|
||||
|
|
@ -196,6 +202,8 @@ func getThenLoaders[Q orm.Loadable]() thenLoaders[Q] {
|
|||
Notification: buildNotificationThenLoader[Q](),
|
||||
OauthToken: buildOauthTokenThenLoader[Q](),
|
||||
Organization: buildOrganizationThenLoader[Q](),
|
||||
PublicreportPool: buildPublicreportPoolThenLoader[Q](),
|
||||
PublicreportPoolPhoto: buildPublicreportPoolPhotoThenLoader[Q](),
|
||||
PublicreportQuick: buildPublicreportQuickThenLoader[Q](),
|
||||
PublicreportQuickPhoto: buildPublicreportQuickPhotoThenLoader[Q](),
|
||||
User: buildUserThenLoader[Q](),
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ func Where[Q psql.Filterable]() struct {
|
|||
OauthTokens oauthTokenWhere[Q]
|
||||
Organizations organizationWhere[Q]
|
||||
PublicreportNuisances publicreportNuisanceWhere[Q]
|
||||
PublicreportPools publicreportPoolWhere[Q]
|
||||
PublicreportPoolPhotos publicreportPoolPhotoWhere[Q]
|
||||
PublicreportQuicks publicreportQuickWhere[Q]
|
||||
PublicreportQuickPhotos publicreportQuickPhotoWhere[Q]
|
||||
RasterColumns rasterColumnWhere[Q]
|
||||
|
|
@ -110,6 +112,8 @@ func Where[Q psql.Filterable]() struct {
|
|||
OauthTokens oauthTokenWhere[Q]
|
||||
Organizations organizationWhere[Q]
|
||||
PublicreportNuisances publicreportNuisanceWhere[Q]
|
||||
PublicreportPools publicreportPoolWhere[Q]
|
||||
PublicreportPoolPhotos publicreportPoolPhotoWhere[Q]
|
||||
PublicreportQuicks publicreportQuickWhere[Q]
|
||||
PublicreportQuickPhotos publicreportQuickPhotoWhere[Q]
|
||||
RasterColumns rasterColumnWhere[Q]
|
||||
|
|
@ -160,6 +164,8 @@ func Where[Q psql.Filterable]() struct {
|
|||
OauthTokens: buildOauthTokenWhere[Q](OauthTokens.Columns),
|
||||
Organizations: buildOrganizationWhere[Q](Organizations.Columns),
|
||||
PublicreportNuisances: buildPublicreportNuisanceWhere[Q](PublicreportNuisances.Columns),
|
||||
PublicreportPools: buildPublicreportPoolWhere[Q](PublicreportPools.Columns),
|
||||
PublicreportPoolPhotos: buildPublicreportPoolPhotoWhere[Q](PublicreportPoolPhotos.Columns),
|
||||
PublicreportQuicks: buildPublicreportQuickWhere[Q](PublicreportQuicks.Columns),
|
||||
PublicreportQuickPhotos: buildPublicreportQuickPhotoWhere[Q](PublicreportQuickPhotos.Columns),
|
||||
RasterColumns: buildRasterColumnWhere[Q](RasterColumns.Columns),
|
||||
|
|
|
|||
1295
db/models/publicreport.pool.bob.go
Normal file
1295
db/models/publicreport.pool.bob.go
Normal file
File diff suppressed because it is too large
Load diff
678
db/models/publicreport.pool_photo.bob.go
Normal file
678
db/models/publicreport.pool_photo.bob.go
Normal file
|
|
@ -0,0 +1,678 @@
|
|||
// Code generated by BobGen psql v0.0.4-0.20260105020634-53e08d840e47+dirty. DO NOT EDIT.
|
||||
// This file is meant to be re-generated in place and/or deleted at any time.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/aarondl/opt/omit"
|
||||
"github.com/google/uuid"
|
||||
"github.com/stephenafamo/bob"
|
||||
"github.com/stephenafamo/bob/dialect/psql"
|
||||
"github.com/stephenafamo/bob/dialect/psql/dialect"
|
||||
"github.com/stephenafamo/bob/dialect/psql/dm"
|
||||
"github.com/stephenafamo/bob/dialect/psql/sm"
|
||||
"github.com/stephenafamo/bob/dialect/psql/um"
|
||||
"github.com/stephenafamo/bob/expr"
|
||||
"github.com/stephenafamo/bob/mods"
|
||||
"github.com/stephenafamo/bob/orm"
|
||||
"github.com/stephenafamo/bob/types/pgtypes"
|
||||
)
|
||||
|
||||
// PublicreportPoolPhoto is an object representing the database table.
|
||||
type PublicreportPoolPhoto struct {
|
||||
ID int32 `db:"id,pk" `
|
||||
Size int64 `db:"size" `
|
||||
Filename string `db:"filename" `
|
||||
PoolID int32 `db:"pool_id" `
|
||||
UUID uuid.UUID `db:"uuid" `
|
||||
|
||||
R publicreportPoolPhotoR `db:"-" `
|
||||
}
|
||||
|
||||
// PublicreportPoolPhotoSlice is an alias for a slice of pointers to PublicreportPoolPhoto.
|
||||
// This should almost always be used instead of []*PublicreportPoolPhoto.
|
||||
type PublicreportPoolPhotoSlice []*PublicreportPoolPhoto
|
||||
|
||||
// PublicreportPoolPhotos contains methods to work with the pool_photo table
|
||||
var PublicreportPoolPhotos = psql.NewTablex[*PublicreportPoolPhoto, PublicreportPoolPhotoSlice, *PublicreportPoolPhotoSetter]("publicreport", "pool_photo", buildPublicreportPoolPhotoColumns("publicreport.pool_photo"))
|
||||
|
||||
// PublicreportPoolPhotosQuery is a query on the pool_photo table
|
||||
type PublicreportPoolPhotosQuery = *psql.ViewQuery[*PublicreportPoolPhoto, PublicreportPoolPhotoSlice]
|
||||
|
||||
// publicreportPoolPhotoR is where relationships are stored.
|
||||
type publicreportPoolPhotoR struct {
|
||||
Pool *PublicreportPool // publicreport.pool_photo.pool_photo_pool_id_fkey
|
||||
}
|
||||
|
||||
func buildPublicreportPoolPhotoColumns(alias string) publicreportPoolPhotoColumns {
|
||||
return publicreportPoolPhotoColumns{
|
||||
ColumnsExpr: expr.NewColumnsExpr(
|
||||
"id", "size", "filename", "pool_id", "uuid",
|
||||
).WithParent("publicreport.pool_photo"),
|
||||
tableAlias: alias,
|
||||
ID: psql.Quote(alias, "id"),
|
||||
Size: psql.Quote(alias, "size"),
|
||||
Filename: psql.Quote(alias, "filename"),
|
||||
PoolID: psql.Quote(alias, "pool_id"),
|
||||
UUID: psql.Quote(alias, "uuid"),
|
||||
}
|
||||
}
|
||||
|
||||
type publicreportPoolPhotoColumns struct {
|
||||
expr.ColumnsExpr
|
||||
tableAlias string
|
||||
ID psql.Expression
|
||||
Size psql.Expression
|
||||
Filename psql.Expression
|
||||
PoolID psql.Expression
|
||||
UUID psql.Expression
|
||||
}
|
||||
|
||||
func (c publicreportPoolPhotoColumns) Alias() string {
|
||||
return c.tableAlias
|
||||
}
|
||||
|
||||
func (publicreportPoolPhotoColumns) AliasedAs(alias string) publicreportPoolPhotoColumns {
|
||||
return buildPublicreportPoolPhotoColumns(alias)
|
||||
}
|
||||
|
||||
// PublicreportPoolPhotoSetter is used for insert/upsert/update operations
|
||||
// All values are optional, and do not have to be set
|
||||
// Generated columns are not included
|
||||
type PublicreportPoolPhotoSetter struct {
|
||||
ID omit.Val[int32] `db:"id,pk" `
|
||||
Size omit.Val[int64] `db:"size" `
|
||||
Filename omit.Val[string] `db:"filename" `
|
||||
PoolID omit.Val[int32] `db:"pool_id" `
|
||||
UUID omit.Val[uuid.UUID] `db:"uuid" `
|
||||
}
|
||||
|
||||
func (s PublicreportPoolPhotoSetter) SetColumns() []string {
|
||||
vals := make([]string, 0, 5)
|
||||
if s.ID.IsValue() {
|
||||
vals = append(vals, "id")
|
||||
}
|
||||
if s.Size.IsValue() {
|
||||
vals = append(vals, "size")
|
||||
}
|
||||
if s.Filename.IsValue() {
|
||||
vals = append(vals, "filename")
|
||||
}
|
||||
if s.PoolID.IsValue() {
|
||||
vals = append(vals, "pool_id")
|
||||
}
|
||||
if s.UUID.IsValue() {
|
||||
vals = append(vals, "uuid")
|
||||
}
|
||||
return vals
|
||||
}
|
||||
|
||||
func (s PublicreportPoolPhotoSetter) Overwrite(t *PublicreportPoolPhoto) {
|
||||
if s.ID.IsValue() {
|
||||
t.ID = s.ID.MustGet()
|
||||
}
|
||||
if s.Size.IsValue() {
|
||||
t.Size = s.Size.MustGet()
|
||||
}
|
||||
if s.Filename.IsValue() {
|
||||
t.Filename = s.Filename.MustGet()
|
||||
}
|
||||
if s.PoolID.IsValue() {
|
||||
t.PoolID = s.PoolID.MustGet()
|
||||
}
|
||||
if s.UUID.IsValue() {
|
||||
t.UUID = s.UUID.MustGet()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *PublicreportPoolPhotoSetter) Apply(q *dialect.InsertQuery) {
|
||||
q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) {
|
||||
return PublicreportPoolPhotos.BeforeInsertHooks.RunHooks(ctx, exec, s)
|
||||
})
|
||||
|
||||
q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
||||
vals := make([]bob.Expression, 5)
|
||||
if s.ID.IsValue() {
|
||||
vals[0] = psql.Arg(s.ID.MustGet())
|
||||
} else {
|
||||
vals[0] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
if s.Size.IsValue() {
|
||||
vals[1] = psql.Arg(s.Size.MustGet())
|
||||
} else {
|
||||
vals[1] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
if s.Filename.IsValue() {
|
||||
vals[2] = psql.Arg(s.Filename.MustGet())
|
||||
} else {
|
||||
vals[2] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
if s.PoolID.IsValue() {
|
||||
vals[3] = psql.Arg(s.PoolID.MustGet())
|
||||
} else {
|
||||
vals[3] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
if s.UUID.IsValue() {
|
||||
vals[4] = psql.Arg(s.UUID.MustGet())
|
||||
} else {
|
||||
vals[4] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "")
|
||||
}))
|
||||
}
|
||||
|
||||
func (s PublicreportPoolPhotoSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] {
|
||||
return um.Set(s.Expressions()...)
|
||||
}
|
||||
|
||||
func (s PublicreportPoolPhotoSetter) Expressions(prefix ...string) []bob.Expression {
|
||||
exprs := make([]bob.Expression, 0, 5)
|
||||
|
||||
if s.ID.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "id")...),
|
||||
psql.Arg(s.ID),
|
||||
}})
|
||||
}
|
||||
|
||||
if s.Size.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "size")...),
|
||||
psql.Arg(s.Size),
|
||||
}})
|
||||
}
|
||||
|
||||
if s.Filename.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "filename")...),
|
||||
psql.Arg(s.Filename),
|
||||
}})
|
||||
}
|
||||
|
||||
if s.PoolID.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "pool_id")...),
|
||||
psql.Arg(s.PoolID),
|
||||
}})
|
||||
}
|
||||
|
||||
if s.UUID.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "uuid")...),
|
||||
psql.Arg(s.UUID),
|
||||
}})
|
||||
}
|
||||
|
||||
return exprs
|
||||
}
|
||||
|
||||
// FindPublicreportPoolPhoto retrieves a single record by primary key
|
||||
// If cols is empty Find will return all columns.
|
||||
func FindPublicreportPoolPhoto(ctx context.Context, exec bob.Executor, IDPK int32, cols ...string) (*PublicreportPoolPhoto, error) {
|
||||
if len(cols) == 0 {
|
||||
return PublicreportPoolPhotos.Query(
|
||||
sm.Where(PublicreportPoolPhotos.Columns.ID.EQ(psql.Arg(IDPK))),
|
||||
).One(ctx, exec)
|
||||
}
|
||||
|
||||
return PublicreportPoolPhotos.Query(
|
||||
sm.Where(PublicreportPoolPhotos.Columns.ID.EQ(psql.Arg(IDPK))),
|
||||
sm.Columns(PublicreportPoolPhotos.Columns.Only(cols...)),
|
||||
).One(ctx, exec)
|
||||
}
|
||||
|
||||
// PublicreportPoolPhotoExists checks the presence of a single record by primary key
|
||||
func PublicreportPoolPhotoExists(ctx context.Context, exec bob.Executor, IDPK int32) (bool, error) {
|
||||
return PublicreportPoolPhotos.Query(
|
||||
sm.Where(PublicreportPoolPhotos.Columns.ID.EQ(psql.Arg(IDPK))),
|
||||
).Exists(ctx, exec)
|
||||
}
|
||||
|
||||
// AfterQueryHook is called after PublicreportPoolPhoto is retrieved from the database
|
||||
func (o *PublicreportPoolPhoto) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
|
||||
var err error
|
||||
|
||||
switch queryType {
|
||||
case bob.QueryTypeSelect:
|
||||
ctx, err = PublicreportPoolPhotos.AfterSelectHooks.RunHooks(ctx, exec, PublicreportPoolPhotoSlice{o})
|
||||
case bob.QueryTypeInsert:
|
||||
ctx, err = PublicreportPoolPhotos.AfterInsertHooks.RunHooks(ctx, exec, PublicreportPoolPhotoSlice{o})
|
||||
case bob.QueryTypeUpdate:
|
||||
ctx, err = PublicreportPoolPhotos.AfterUpdateHooks.RunHooks(ctx, exec, PublicreportPoolPhotoSlice{o})
|
||||
case bob.QueryTypeDelete:
|
||||
ctx, err = PublicreportPoolPhotos.AfterDeleteHooks.RunHooks(ctx, exec, PublicreportPoolPhotoSlice{o})
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// primaryKeyVals returns the primary key values of the PublicreportPoolPhoto
|
||||
func (o *PublicreportPoolPhoto) primaryKeyVals() bob.Expression {
|
||||
return psql.Arg(o.ID)
|
||||
}
|
||||
|
||||
func (o *PublicreportPoolPhoto) pkEQ() dialect.Expression {
|
||||
return psql.Quote("publicreport.pool_photo", "id").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
||||
return o.primaryKeyVals().WriteSQL(ctx, w, d, start)
|
||||
}))
|
||||
}
|
||||
|
||||
// Update uses an executor to update the PublicreportPoolPhoto
|
||||
func (o *PublicreportPoolPhoto) Update(ctx context.Context, exec bob.Executor, s *PublicreportPoolPhotoSetter) error {
|
||||
v, err := PublicreportPoolPhotos.Update(s.UpdateMod(), um.Where(o.pkEQ())).One(ctx, exec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
o.R = v.R
|
||||
*o = *v
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Delete deletes a single PublicreportPoolPhoto record with an executor
|
||||
func (o *PublicreportPoolPhoto) Delete(ctx context.Context, exec bob.Executor) error {
|
||||
_, err := PublicreportPoolPhotos.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec)
|
||||
return err
|
||||
}
|
||||
|
||||
// Reload refreshes the PublicreportPoolPhoto using the executor
|
||||
func (o *PublicreportPoolPhoto) Reload(ctx context.Context, exec bob.Executor) error {
|
||||
o2, err := PublicreportPoolPhotos.Query(
|
||||
sm.Where(PublicreportPoolPhotos.Columns.ID.EQ(psql.Arg(o.ID))),
|
||||
).One(ctx, exec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
o2.R = o.R
|
||||
*o = *o2
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// AfterQueryHook is called after PublicreportPoolPhotoSlice is retrieved from the database
|
||||
func (o PublicreportPoolPhotoSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
|
||||
var err error
|
||||
|
||||
switch queryType {
|
||||
case bob.QueryTypeSelect:
|
||||
ctx, err = PublicreportPoolPhotos.AfterSelectHooks.RunHooks(ctx, exec, o)
|
||||
case bob.QueryTypeInsert:
|
||||
ctx, err = PublicreportPoolPhotos.AfterInsertHooks.RunHooks(ctx, exec, o)
|
||||
case bob.QueryTypeUpdate:
|
||||
ctx, err = PublicreportPoolPhotos.AfterUpdateHooks.RunHooks(ctx, exec, o)
|
||||
case bob.QueryTypeDelete:
|
||||
ctx, err = PublicreportPoolPhotos.AfterDeleteHooks.RunHooks(ctx, exec, o)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (o PublicreportPoolPhotoSlice) pkIN() dialect.Expression {
|
||||
if len(o) == 0 {
|
||||
return psql.Raw("NULL")
|
||||
}
|
||||
|
||||
return psql.Quote("publicreport.pool_photo", "id").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
||||
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
|
||||
func (o PublicreportPoolPhotoSlice) copyMatchingRows(from ...*PublicreportPoolPhoto) {
|
||||
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...)"
|
||||
func (o PublicreportPoolPhotoSlice) UpdateMod() bob.Mod[*dialect.UpdateQuery] {
|
||||
return bob.ModFunc[*dialect.UpdateQuery](func(q *dialect.UpdateQuery) {
|
||||
q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) {
|
||||
return PublicreportPoolPhotos.BeforeUpdateHooks.RunHooks(ctx, exec, o)
|
||||
})
|
||||
|
||||
q.AppendLoader(bob.LoaderFunc(func(ctx context.Context, exec bob.Executor, retrieved any) error {
|
||||
var err error
|
||||
switch retrieved := retrieved.(type) {
|
||||
case *PublicreportPoolPhoto:
|
||||
o.copyMatchingRows(retrieved)
|
||||
case []*PublicreportPoolPhoto:
|
||||
o.copyMatchingRows(retrieved...)
|
||||
case PublicreportPoolPhotoSlice:
|
||||
o.copyMatchingRows(retrieved...)
|
||||
default:
|
||||
// If the retrieved value is not a PublicreportPoolPhoto or a slice of PublicreportPoolPhoto
|
||||
// then run the AfterUpdateHooks on the slice
|
||||
_, err = PublicreportPoolPhotos.AfterUpdateHooks.RunHooks(ctx, exec, o)
|
||||
}
|
||||
|
||||
return err
|
||||
}))
|
||||
|
||||
q.AppendWhere(o.pkIN())
|
||||
})
|
||||
}
|
||||
|
||||
// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)"
|
||||
func (o PublicreportPoolPhotoSlice) DeleteMod() bob.Mod[*dialect.DeleteQuery] {
|
||||
return bob.ModFunc[*dialect.DeleteQuery](func(q *dialect.DeleteQuery) {
|
||||
q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) {
|
||||
return PublicreportPoolPhotos.BeforeDeleteHooks.RunHooks(ctx, exec, o)
|
||||
})
|
||||
|
||||
q.AppendLoader(bob.LoaderFunc(func(ctx context.Context, exec bob.Executor, retrieved any) error {
|
||||
var err error
|
||||
switch retrieved := retrieved.(type) {
|
||||
case *PublicreportPoolPhoto:
|
||||
o.copyMatchingRows(retrieved)
|
||||
case []*PublicreportPoolPhoto:
|
||||
o.copyMatchingRows(retrieved...)
|
||||
case PublicreportPoolPhotoSlice:
|
||||
o.copyMatchingRows(retrieved...)
|
||||
default:
|
||||
// If the retrieved value is not a PublicreportPoolPhoto or a slice of PublicreportPoolPhoto
|
||||
// then run the AfterDeleteHooks on the slice
|
||||
_, err = PublicreportPoolPhotos.AfterDeleteHooks.RunHooks(ctx, exec, o)
|
||||
}
|
||||
|
||||
return err
|
||||
}))
|
||||
|
||||
q.AppendWhere(o.pkIN())
|
||||
})
|
||||
}
|
||||
|
||||
func (o PublicreportPoolPhotoSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals PublicreportPoolPhotoSetter) error {
|
||||
if len(o) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
_, err := PublicreportPoolPhotos.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec)
|
||||
return err
|
||||
}
|
||||
|
||||
func (o PublicreportPoolPhotoSlice) DeleteAll(ctx context.Context, exec bob.Executor) error {
|
||||
if len(o) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
_, err := PublicreportPoolPhotos.Delete(o.DeleteMod()).Exec(ctx, exec)
|
||||
return err
|
||||
}
|
||||
|
||||
func (o PublicreportPoolPhotoSlice) ReloadAll(ctx context.Context, exec bob.Executor) error {
|
||||
if len(o) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
o2, err := PublicreportPoolPhotos.Query(sm.Where(o.pkIN())).All(ctx, exec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
o.copyMatchingRows(o2...)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Pool starts a query for related objects on publicreport.pool
|
||||
func (o *PublicreportPoolPhoto) Pool(mods ...bob.Mod[*dialect.SelectQuery]) PublicreportPoolsQuery {
|
||||
return PublicreportPools.Query(append(mods,
|
||||
sm.Where(PublicreportPools.Columns.ID.EQ(psql.Arg(o.PoolID))),
|
||||
)...)
|
||||
}
|
||||
|
||||
func (os PublicreportPoolPhotoSlice) Pool(mods ...bob.Mod[*dialect.SelectQuery]) PublicreportPoolsQuery {
|
||||
pkPoolID := make(pgtypes.Array[int32], 0, len(os))
|
||||
for _, o := range os {
|
||||
if o == nil {
|
||||
continue
|
||||
}
|
||||
pkPoolID = append(pkPoolID, o.PoolID)
|
||||
}
|
||||
PKArgExpr := psql.Select(sm.Columns(
|
||||
psql.F("unnest", psql.Cast(psql.Arg(pkPoolID), "integer[]")),
|
||||
))
|
||||
|
||||
return PublicreportPools.Query(append(mods,
|
||||
sm.Where(psql.Group(PublicreportPools.Columns.ID).OP("IN", PKArgExpr)),
|
||||
)...)
|
||||
}
|
||||
|
||||
func attachPublicreportPoolPhotoPool0(ctx context.Context, exec bob.Executor, count int, publicreportPoolPhoto0 *PublicreportPoolPhoto, publicreportPool1 *PublicreportPool) (*PublicreportPoolPhoto, error) {
|
||||
setter := &PublicreportPoolPhotoSetter{
|
||||
PoolID: omit.From(publicreportPool1.ID),
|
||||
}
|
||||
|
||||
err := publicreportPoolPhoto0.Update(ctx, exec, setter)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("attachPublicreportPoolPhotoPool0: %w", err)
|
||||
}
|
||||
|
||||
return publicreportPoolPhoto0, nil
|
||||
}
|
||||
|
||||
func (publicreportPoolPhoto0 *PublicreportPoolPhoto) InsertPool(ctx context.Context, exec bob.Executor, related *PublicreportPoolSetter) error {
|
||||
var err error
|
||||
|
||||
publicreportPool1, err := PublicreportPools.Insert(related).One(ctx, exec)
|
||||
if err != nil {
|
||||
return fmt.Errorf("inserting related objects: %w", err)
|
||||
}
|
||||
|
||||
_, err = attachPublicreportPoolPhotoPool0(ctx, exec, 1, publicreportPoolPhoto0, publicreportPool1)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
publicreportPoolPhoto0.R.Pool = publicreportPool1
|
||||
|
||||
publicreportPool1.R.PoolPhotos = append(publicreportPool1.R.PoolPhotos, publicreportPoolPhoto0)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (publicreportPoolPhoto0 *PublicreportPoolPhoto) AttachPool(ctx context.Context, exec bob.Executor, publicreportPool1 *PublicreportPool) error {
|
||||
var err error
|
||||
|
||||
_, err = attachPublicreportPoolPhotoPool0(ctx, exec, 1, publicreportPoolPhoto0, publicreportPool1)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
publicreportPoolPhoto0.R.Pool = publicreportPool1
|
||||
|
||||
publicreportPool1.R.PoolPhotos = append(publicreportPool1.R.PoolPhotos, publicreportPoolPhoto0)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type publicreportPoolPhotoWhere[Q psql.Filterable] struct {
|
||||
ID psql.WhereMod[Q, int32]
|
||||
Size psql.WhereMod[Q, int64]
|
||||
Filename psql.WhereMod[Q, string]
|
||||
PoolID psql.WhereMod[Q, int32]
|
||||
UUID psql.WhereMod[Q, uuid.UUID]
|
||||
}
|
||||
|
||||
func (publicreportPoolPhotoWhere[Q]) AliasedAs(alias string) publicreportPoolPhotoWhere[Q] {
|
||||
return buildPublicreportPoolPhotoWhere[Q](buildPublicreportPoolPhotoColumns(alias))
|
||||
}
|
||||
|
||||
func buildPublicreportPoolPhotoWhere[Q psql.Filterable](cols publicreportPoolPhotoColumns) publicreportPoolPhotoWhere[Q] {
|
||||
return publicreportPoolPhotoWhere[Q]{
|
||||
ID: psql.Where[Q, int32](cols.ID),
|
||||
Size: psql.Where[Q, int64](cols.Size),
|
||||
Filename: psql.Where[Q, string](cols.Filename),
|
||||
PoolID: psql.Where[Q, int32](cols.PoolID),
|
||||
UUID: psql.Where[Q, uuid.UUID](cols.UUID),
|
||||
}
|
||||
}
|
||||
|
||||
func (o *PublicreportPoolPhoto) Preload(name string, retrieved any) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
switch name {
|
||||
case "Pool":
|
||||
rel, ok := retrieved.(*PublicreportPool)
|
||||
if !ok {
|
||||
return fmt.Errorf("publicreportPoolPhoto cannot load %T as %q", retrieved, name)
|
||||
}
|
||||
|
||||
o.R.Pool = rel
|
||||
|
||||
if rel != nil {
|
||||
rel.R.PoolPhotos = PublicreportPoolPhotoSlice{o}
|
||||
}
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("publicreportPoolPhoto has no relationship %q", name)
|
||||
}
|
||||
}
|
||||
|
||||
type publicreportPoolPhotoPreloader struct {
|
||||
Pool func(...psql.PreloadOption) psql.Preloader
|
||||
}
|
||||
|
||||
func buildPublicreportPoolPhotoPreloader() publicreportPoolPhotoPreloader {
|
||||
return publicreportPoolPhotoPreloader{
|
||||
Pool: func(opts ...psql.PreloadOption) psql.Preloader {
|
||||
return psql.Preload[*PublicreportPool, PublicreportPoolSlice](psql.PreloadRel{
|
||||
Name: "Pool",
|
||||
Sides: []psql.PreloadSide{
|
||||
{
|
||||
From: PublicreportPoolPhotos,
|
||||
To: PublicreportPools,
|
||||
FromColumns: []string{"pool_id"},
|
||||
ToColumns: []string{"id"},
|
||||
},
|
||||
},
|
||||
}, PublicreportPools.Columns.Names(), opts...)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type publicreportPoolPhotoThenLoader[Q orm.Loadable] struct {
|
||||
Pool func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
||||
}
|
||||
|
||||
func buildPublicreportPoolPhotoThenLoader[Q orm.Loadable]() publicreportPoolPhotoThenLoader[Q] {
|
||||
type PoolLoadInterface interface {
|
||||
LoadPool(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
||||
}
|
||||
|
||||
return publicreportPoolPhotoThenLoader[Q]{
|
||||
Pool: thenLoadBuilder[Q](
|
||||
"Pool",
|
||||
func(ctx context.Context, exec bob.Executor, retrieved PoolLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
return retrieved.LoadPool(ctx, exec, mods...)
|
||||
},
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
// LoadPool loads the publicreportPoolPhoto's Pool into the .R struct
|
||||
func (o *PublicreportPoolPhoto) LoadPool(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Reset the relationship
|
||||
o.R.Pool = nil
|
||||
|
||||
related, err := o.Pool(mods...).One(ctx, exec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
related.R.PoolPhotos = PublicreportPoolPhotoSlice{o}
|
||||
|
||||
o.R.Pool = related
|
||||
return nil
|
||||
}
|
||||
|
||||
// LoadPool loads the publicreportPoolPhoto's Pool into the .R struct
|
||||
func (os PublicreportPoolPhotoSlice) LoadPool(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
if len(os) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
publicreportPools, err := os.Pool(mods...).All(ctx, exec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, o := range os {
|
||||
if o == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, rel := range publicreportPools {
|
||||
|
||||
if !(o.PoolID == rel.ID) {
|
||||
continue
|
||||
}
|
||||
|
||||
rel.R.PoolPhotos = append(rel.R.PoolPhotos, o)
|
||||
|
||||
o.R.Pool = rel
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type publicreportPoolPhotoJoins[Q dialect.Joinable] struct {
|
||||
typ string
|
||||
Pool modAs[Q, publicreportPoolColumns]
|
||||
}
|
||||
|
||||
func (j publicreportPoolPhotoJoins[Q]) aliasedAs(alias string) publicreportPoolPhotoJoins[Q] {
|
||||
return buildPublicreportPoolPhotoJoins[Q](buildPublicreportPoolPhotoColumns(alias), j.typ)
|
||||
}
|
||||
|
||||
func buildPublicreportPoolPhotoJoins[Q dialect.Joinable](cols publicreportPoolPhotoColumns, typ string) publicreportPoolPhotoJoins[Q] {
|
||||
return publicreportPoolPhotoJoins[Q]{
|
||||
typ: typ,
|
||||
Pool: modAs[Q, publicreportPoolColumns]{
|
||||
c: PublicreportPools.Columns,
|
||||
f: func(to publicreportPoolColumns) bob.Mod[Q] {
|
||||
mods := make(mods.QueryMods[Q], 0, 1)
|
||||
|
||||
{
|
||||
mods = append(mods, dialect.Join[Q](typ, PublicreportPools.Name().As(to.Alias())).On(
|
||||
to.ID.EQ(cols.PoolID),
|
||||
))
|
||||
}
|
||||
|
||||
return mods
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue