Remove old FieldSeeker tables, use v2 generated tables.

This requires a bunch of changes since the types on these tables are
much closer to the underlying types of the Fieldseeker data we are
getting back from the API.

I now need to use proper UUID types everywhere, which means I had to
modify the bob gen config to consistently use google UUID, my UUID
library of choice.

I also had to add the organization_id to all the fieldseeker tables
since we rely on them existing for some of our compound queries.

There were some changes to the API type signatures to get things to
build. I may yet regret those.
This commit is contained in:
Eli Ribble 2025-12-24 17:49:39 -07:00
parent 58f5afccc9
commit 1395e3d3ac
445 changed files with 54077 additions and 275856 deletions

View file

@ -1,18 +1,19 @@
// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT.
// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
package models
import (
"context"
"encoding/json"
"fmt"
"io"
"time"
enums "github.com/Gleipnir-Technology/nidus-sync/db/enums"
"github.com/aarondl/opt/null"
"github.com/aarondl/opt/omit"
"github.com/aarondl/opt/omitnull"
"github.com/gofrs/uuid/v5"
"github.com/google/uuid"
"github.com/stephenafamo/bob"
"github.com/stephenafamo/bob/dialect/psql"
"github.com/stephenafamo/bob/dialect/psql/dialect"
@ -20,116 +21,143 @@ import (
"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"
"github.com/stephenafamo/bob/types/pgtypes"
)
// FieldseekerQamosquitoinspection is an object representing the database table.
type FieldseekerQamosquitoinspection struct {
Objectid int64 `db:"objectid,pk" `
// Positive Dips
// Original attribute from ArcGIS API is POSDIPS
Posdips null.Val[int16] `db:"posdips" `
// Action
Actiontaken null.Val[enums.FieldseekerQamosquitoinspectionMosquitoactionEnum] `db:"actiontaken" `
// Comments
// Original attribute from ArcGIS API is ACTIONTAKEN
Actiontaken null.Val[string] `db:"actiontaken" `
// Original attribute from ArcGIS API is COMMENTS
Comments null.Val[string] `db:"comments" `
// Average Temperature
// Original attribute from ArcGIS API is AVETEMP
Avetemp null.Val[float64] `db:"avetemp" `
// Wind Speed
// Original attribute from ArcGIS API is WINDSPEED
Windspeed null.Val[float64] `db:"windspeed" `
// Rain Gauge
Raingauge null.Val[float64] `db:"raingauge" `
Globalid null.Val[uuid.UUID] `db:"globalid" `
// Start
// Original attribute from ArcGIS API is RAINGAUGE
Raingauge null.Val[float64] `db:"raingauge" `
// Original attribute from ArcGIS API is GlobalID
Globalid null.Val[uuid.UUID] `db:"globalid" `
// Original attribute from ArcGIS API is STARTDATETIME
Startdatetime null.Val[time.Time] `db:"startdatetime" `
// Finish
// Original attribute from ArcGIS API is ENDDATETIME
Enddatetime null.Val[time.Time] `db:"enddatetime" `
// Wind Direction
Winddir null.Val[string] `db:"winddir" `
Reviewed null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"reviewed" `
Reviewedby null.Val[string] `db:"reviewedby" `
Revieweddate null.Val[time.Time] `db:"revieweddate" `
Locationname null.Val[string] `db:"locationname" `
Zone null.Val[string] `db:"zone" `
Recordstatus null.Val[int16] `db:"recordstatus" `
Zone2 null.Val[string] `db:"zone2" `
// Landing Rate
// Original attribute from ArcGIS API is WINDDIR
Winddir null.Val[string] `db:"winddir" `
// Original attribute from ArcGIS API is REVIEWED
Reviewed null.Val[int16] `db:"reviewed" `
// Original attribute from ArcGIS API is REVIEWEDBY
Reviewedby null.Val[string] `db:"reviewedby" `
// Original attribute from ArcGIS API is REVIEWEDDATE
Revieweddate null.Val[time.Time] `db:"revieweddate" `
// Original attribute from ArcGIS API is LOCATIONNAME
Locationname null.Val[string] `db:"locationname" `
// Original attribute from ArcGIS API is ZONE
Zone null.Val[string] `db:"zone" `
// Original attribute from ArcGIS API is RECORDSTATUS
Recordstatus null.Val[int16] `db:"recordstatus" `
// Original attribute from ArcGIS API is ZONE2
Zone2 null.Val[string] `db:"zone2" `
// Original attribute from ArcGIS API is LR
LR null.Val[int16] `db:"lr" `
// Negative Dips
// Original attribute from ArcGIS API is NEGDIPS
Negdips null.Val[int16] `db:"negdips" `
// Total Acres
// Original attribute from ArcGIS API is TOTALACRES
Totalacres null.Val[float64] `db:"totalacres" `
// Acres Breeding
// Original attribute from ArcGIS API is ACRESBREEDING
Acresbreeding null.Val[float64] `db:"acresbreeding" `
// Fish Present?
Fish null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"fish" `
// Site Type
Sitetype null.Val[enums.FieldseekerQamosquitoinspectionQasitetypeEnum] `db:"sitetype" `
// Breeding Potential
Breedingpotential null.Val[enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum] `db:"breedingpotential" `
// Moving Water
Movingwater null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"movingwater" `
// No Evidence of Water Ever
Nowaterever null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"nowaterever" `
// Mosquito Habitat Indicators
Mosquitohabitat null.Val[enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum] `db:"mosquitohabitat" `
// Habitat Value
// Original attribute from ArcGIS API is FISH
Fish null.Val[int16] `db:"fish" `
// Original attribute from ArcGIS API is SITETYPE
Sitetype null.Val[string] `db:"sitetype" `
// Original attribute from ArcGIS API is BREEDINGPOTENTIAL
Breedingpotential null.Val[string] `db:"breedingpotential" `
// Original attribute from ArcGIS API is MOVINGWATER
Movingwater null.Val[int16] `db:"movingwater" `
// Original attribute from ArcGIS API is NOWATEREVER
Nowaterever null.Val[int16] `db:"nowaterever" `
// Original attribute from ArcGIS API is MOSQUITOHABITAT
Mosquitohabitat null.Val[string] `db:"mosquitohabitat" `
// Original attribute from ArcGIS API is HABVALUE1
Habvalue1 null.Val[int16] `db:"habvalue1" `
// %
// Original attribute from ArcGIS API is HABVALUE1PERCENT
Habvalue1percent null.Val[int16] `db:"habvalue1percent" `
// Habitat Value
// Original attribute from ArcGIS API is HABVALUE2
Habvalue2 null.Val[int16] `db:"habvalue2" `
// %
// Original attribute from ArcGIS API is HABVALUE2PERCENT
Habvalue2percent null.Val[int16] `db:"habvalue2percent" `
// Potential
// Original attribute from ArcGIS API is POTENTIAL
Potential null.Val[int16] `db:"potential" `
// Larvae Present
Larvaepresent null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"larvaepresent" `
// Larvae Inside Treated Area?
Larvaeinsidetreatedarea null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"larvaeinsidetreatedarea" `
// Larvae Outside Treated Area?
Larvaeoutsidetreatedarea null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"larvaeoutsidetreatedarea" `
// Reason Larvae Present
Larvaereason null.Val[enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum] `db:"larvaereason" `
// Aquatic Organisms
Aquaticorganisms null.Val[enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum] `db:"aquaticorganisms" `
// Vegetation
Vegetation null.Val[enums.FieldseekerQamosquitoinspectionQavegetationEnum] `db:"vegetation" `
// Source Reduction
Sourcereduction null.Val[enums.FieldseekerQamosquitoinspectionQasourcereductionEnum] `db:"sourcereduction" `
// Water Present?
Waterpresent null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"waterpresent" `
// Water Movement
Watermovement1 null.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum] `db:"watermovement1" `
// %
// Original attribute from ArcGIS API is LARVAEPRESENT
Larvaepresent null.Val[int16] `db:"larvaepresent" `
// Original attribute from ArcGIS API is LARVAEINSIDETREATEDAREA
Larvaeinsidetreatedarea null.Val[int16] `db:"larvaeinsidetreatedarea" `
// Original attribute from ArcGIS API is LARVAEOUTSIDETREATEDAREA
Larvaeoutsidetreatedarea null.Val[int16] `db:"larvaeoutsidetreatedarea" `
// Original attribute from ArcGIS API is LARVAEREASON
Larvaereason null.Val[string] `db:"larvaereason" `
// Original attribute from ArcGIS API is AQUATICORGANISMS
Aquaticorganisms null.Val[string] `db:"aquaticorganisms" `
// Original attribute from ArcGIS API is VEGETATION
Vegetation null.Val[string] `db:"vegetation" `
// Original attribute from ArcGIS API is SOURCEREDUCTION
Sourcereduction null.Val[string] `db:"sourcereduction" `
// Original attribute from ArcGIS API is WATERPRESENT
Waterpresent null.Val[int16] `db:"waterpresent" `
// Original attribute from ArcGIS API is WATERMOVEMENT1
Watermovement1 null.Val[string] `db:"watermovement1" `
// Original attribute from ArcGIS API is WATERMOVEMENT1PERCENT
Watermovement1percent null.Val[int16] `db:"watermovement1percent" `
// Water Movement
Watermovement2 null.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum] `db:"watermovement2" `
// %
// Original attribute from ArcGIS API is WATERMOVEMENT2
Watermovement2 null.Val[string] `db:"watermovement2" `
// Original attribute from ArcGIS API is WATERMOVEMENT2PERCENT
Watermovement2percent null.Val[int16] `db:"watermovement2percent" `
// Soil Conditions
Soilconditions null.Val[enums.FieldseekerQamosquitoinspectionQasoilconditionEnum] `db:"soilconditions" `
// How Long Water Present?
Waterduration null.Val[enums.FieldseekerQamosquitoinspectionQawaterdurationEnum] `db:"waterduration" `
// Water Source
Watersource null.Val[enums.FieldseekerQamosquitoinspectionQawatersourceEnum] `db:"watersource" `
// Water Conditions
Waterconditions null.Val[enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum] `db:"waterconditions" `
// Adult Activity
Adultactivity null.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"adultactivity" `
Linelocid null.Val[uuid.UUID] `db:"linelocid" `
Pointlocid null.Val[uuid.UUID] `db:"pointlocid" `
Polygonlocid null.Val[uuid.UUID] `db:"polygonlocid" `
CreatedUser null.Val[string] `db:"created_user" `
CreatedDate null.Val[time.Time] `db:"created_date" `
LastEditedUser null.Val[string] `db:"last_edited_user" `
LastEditedDate null.Val[time.Time] `db:"last_edited_date" `
// Field Tech
Fieldtech null.Val[string] `db:"fieldtech" `
// Original attribute from ArcGIS API is SOILCONDITIONS
Soilconditions null.Val[string] `db:"soilconditions" `
// Original attribute from ArcGIS API is WATERDURATION
Waterduration null.Val[string] `db:"waterduration" `
// Original attribute from ArcGIS API is WATERSOURCE
Watersource null.Val[string] `db:"watersource" `
// Original attribute from ArcGIS API is WATERCONDITIONS
Waterconditions null.Val[string] `db:"waterconditions" `
// Original attribute from ArcGIS API is ADULTACTIVITY
Adultactivity null.Val[int16] `db:"adultactivity" `
// Original attribute from ArcGIS API is LINELOCID
Linelocid null.Val[uuid.UUID] `db:"linelocid" `
// Original attribute from ArcGIS API is POINTLOCID
Pointlocid null.Val[uuid.UUID] `db:"pointlocid" `
// Original attribute from ArcGIS API is POLYGONLOCID
Polygonlocid null.Val[uuid.UUID] `db:"polygonlocid" `
// Original attribute from ArcGIS API is created_user
CreatedUser null.Val[string] `db:"created_user" `
// Original attribute from ArcGIS API is created_date
CreatedDate null.Val[time.Time] `db:"created_date" `
// Original attribute from ArcGIS API is last_edited_user
LastEditedUser null.Val[string] `db:"last_edited_user" `
// Original attribute from ArcGIS API is last_edited_date
LastEditedDate null.Val[time.Time] `db:"last_edited_date" `
// Original attribute from ArcGIS API is FIELDTECH
Fieldtech null.Val[string] `db:"fieldtech" `
// Original attribute from ArcGIS API is CreationDate
Creationdate null.Val[time.Time] `db:"creationdate" `
Creator null.Val[string] `db:"creator" `
Editdate null.Val[time.Time] `db:"editdate" `
Editor null.Val[string] `db:"editor" `
// Tracks version changes to the row. Increases when data is modified.
Version int32 `db:"version,pk" `
// Original attribute from ArcGIS API is Creator
Creator null.Val[string] `db:"creator" `
// Original attribute from ArcGIS API is EditDate
Editdate null.Val[time.Time] `db:"editdate" `
// Original attribute from ArcGIS API is Editor
Editor null.Val[string] `db:"editor" `
Geometry types.JSON[json.RawMessage] `db:"geometry" `
Geospatial null.Val[string] `db:"geospatial" `
Version int32 `db:"version,pk" `
OrganizationID int32 `db:"organization_id" `
R fieldseekerQamosquitoinspectionR `db:"-" `
}
// FieldseekerQamosquitoinspectionSlice is an alias for a slice of pointers to FieldseekerQamosquitoinspection.
@ -142,10 +170,15 @@ var FieldseekerQamosquitoinspections = psql.NewTablex[*FieldseekerQamosquitoinsp
// FieldseekerQamosquitoinspectionsQuery is a query on the qamosquitoinspection table
type FieldseekerQamosquitoinspectionsQuery = *psql.ViewQuery[*FieldseekerQamosquitoinspection, FieldseekerQamosquitoinspectionSlice]
// fieldseekerQamosquitoinspectionR is where relationships are stored.
type fieldseekerQamosquitoinspectionR struct {
Organization *Organization // fieldseeker.qamosquitoinspection.qamosquitoinspection_organization_id_fkey
}
func buildFieldseekerQamosquitoinspectionColumns(alias string) fieldseekerQamosquitoinspectionColumns {
return fieldseekerQamosquitoinspectionColumns{
ColumnsExpr: expr.NewColumnsExpr(
"objectid", "posdips", "actiontaken", "comments", "avetemp", "windspeed", "raingauge", "globalid", "startdatetime", "enddatetime", "winddir", "reviewed", "reviewedby", "revieweddate", "locationname", "zone", "recordstatus", "zone2", "lr", "negdips", "totalacres", "acresbreeding", "fish", "sitetype", "breedingpotential", "movingwater", "nowaterever", "mosquitohabitat", "habvalue1", "habvalue1percent", "habvalue2", "habvalue2percent", "potential", "larvaepresent", "larvaeinsidetreatedarea", "larvaeoutsidetreatedarea", "larvaereason", "aquaticorganisms", "vegetation", "sourcereduction", "waterpresent", "watermovement1", "watermovement1percent", "watermovement2", "watermovement2percent", "soilconditions", "waterduration", "watersource", "waterconditions", "adultactivity", "linelocid", "pointlocid", "polygonlocid", "created_user", "created_date", "last_edited_user", "last_edited_date", "fieldtech", "creationdate", "creator", "editdate", "editor", "version",
"objectid", "posdips", "actiontaken", "comments", "avetemp", "windspeed", "raingauge", "globalid", "startdatetime", "enddatetime", "winddir", "reviewed", "reviewedby", "revieweddate", "locationname", "zone", "recordstatus", "zone2", "lr", "negdips", "totalacres", "acresbreeding", "fish", "sitetype", "breedingpotential", "movingwater", "nowaterever", "mosquitohabitat", "habvalue1", "habvalue1percent", "habvalue2", "habvalue2percent", "potential", "larvaepresent", "larvaeinsidetreatedarea", "larvaeoutsidetreatedarea", "larvaereason", "aquaticorganisms", "vegetation", "sourcereduction", "waterpresent", "watermovement1", "watermovement1percent", "watermovement2", "watermovement2percent", "soilconditions", "waterduration", "watersource", "waterconditions", "adultactivity", "linelocid", "pointlocid", "polygonlocid", "created_user", "created_date", "last_edited_user", "last_edited_date", "fieldtech", "creationdate", "creator", "editdate", "editor", "geometry", "geospatial", "version", "organization_id",
).WithParent("fieldseeker.qamosquitoinspection"),
tableAlias: alias,
Objectid: psql.Quote(alias, "objectid"),
@ -210,7 +243,10 @@ func buildFieldseekerQamosquitoinspectionColumns(alias string) fieldseekerQamosq
Creator: psql.Quote(alias, "creator"),
Editdate: psql.Quote(alias, "editdate"),
Editor: psql.Quote(alias, "editor"),
Geometry: psql.Quote(alias, "geometry"),
Geospatial: psql.Quote(alias, "geospatial"),
Version: psql.Quote(alias, "version"),
OrganizationID: psql.Quote(alias, "organization_id"),
}
}
@ -279,7 +315,10 @@ type fieldseekerQamosquitoinspectionColumns struct {
Creator psql.Expression
Editdate psql.Expression
Editor psql.Expression
Geometry psql.Expression
Geospatial psql.Expression
Version psql.Expression
OrganizationID psql.Expression
}
func (c fieldseekerQamosquitoinspectionColumns) Alias() string {
@ -294,73 +333,76 @@ func (fieldseekerQamosquitoinspectionColumns) AliasedAs(alias string) fieldseeke
// All values are optional, and do not have to be set
// Generated columns are not included
type FieldseekerQamosquitoinspectionSetter struct {
Objectid omit.Val[int64] `db:"objectid,pk" `
Posdips omitnull.Val[int16] `db:"posdips" `
Actiontaken omitnull.Val[enums.FieldseekerQamosquitoinspectionMosquitoactionEnum] `db:"actiontaken" `
Comments omitnull.Val[string] `db:"comments" `
Avetemp omitnull.Val[float64] `db:"avetemp" `
Windspeed omitnull.Val[float64] `db:"windspeed" `
Raingauge omitnull.Val[float64] `db:"raingauge" `
Globalid omitnull.Val[uuid.UUID] `db:"globalid" `
Startdatetime omitnull.Val[time.Time] `db:"startdatetime" `
Enddatetime omitnull.Val[time.Time] `db:"enddatetime" `
Winddir omitnull.Val[string] `db:"winddir" `
Reviewed omitnull.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"reviewed" `
Reviewedby omitnull.Val[string] `db:"reviewedby" `
Revieweddate omitnull.Val[time.Time] `db:"revieweddate" `
Locationname omitnull.Val[string] `db:"locationname" `
Zone omitnull.Val[string] `db:"zone" `
Recordstatus omitnull.Val[int16] `db:"recordstatus" `
Zone2 omitnull.Val[string] `db:"zone2" `
LR omitnull.Val[int16] `db:"lr" `
Negdips omitnull.Val[int16] `db:"negdips" `
Totalacres omitnull.Val[float64] `db:"totalacres" `
Acresbreeding omitnull.Val[float64] `db:"acresbreeding" `
Fish omitnull.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"fish" `
Sitetype omitnull.Val[enums.FieldseekerQamosquitoinspectionQasitetypeEnum] `db:"sitetype" `
Breedingpotential omitnull.Val[enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum] `db:"breedingpotential" `
Movingwater omitnull.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"movingwater" `
Nowaterever omitnull.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"nowaterever" `
Mosquitohabitat omitnull.Val[enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum] `db:"mosquitohabitat" `
Habvalue1 omitnull.Val[int16] `db:"habvalue1" `
Habvalue1percent omitnull.Val[int16] `db:"habvalue1percent" `
Habvalue2 omitnull.Val[int16] `db:"habvalue2" `
Habvalue2percent omitnull.Val[int16] `db:"habvalue2percent" `
Potential omitnull.Val[int16] `db:"potential" `
Larvaepresent omitnull.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"larvaepresent" `
Larvaeinsidetreatedarea omitnull.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"larvaeinsidetreatedarea" `
Larvaeoutsidetreatedarea omitnull.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"larvaeoutsidetreatedarea" `
Larvaereason omitnull.Val[enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum] `db:"larvaereason" `
Aquaticorganisms omitnull.Val[enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum] `db:"aquaticorganisms" `
Vegetation omitnull.Val[enums.FieldseekerQamosquitoinspectionQavegetationEnum] `db:"vegetation" `
Sourcereduction omitnull.Val[enums.FieldseekerQamosquitoinspectionQasourcereductionEnum] `db:"sourcereduction" `
Waterpresent omitnull.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"waterpresent" `
Watermovement1 omitnull.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum] `db:"watermovement1" `
Watermovement1percent omitnull.Val[int16] `db:"watermovement1percent" `
Watermovement2 omitnull.Val[enums.FieldseekerQamosquitoinspectionQawatermovementEnum] `db:"watermovement2" `
Watermovement2percent omitnull.Val[int16] `db:"watermovement2percent" `
Soilconditions omitnull.Val[enums.FieldseekerQamosquitoinspectionQasoilconditionEnum] `db:"soilconditions" `
Waterduration omitnull.Val[enums.FieldseekerQamosquitoinspectionQawaterdurationEnum] `db:"waterduration" `
Watersource omitnull.Val[enums.FieldseekerQamosquitoinspectionQawatersourceEnum] `db:"watersource" `
Waterconditions omitnull.Val[enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum] `db:"waterconditions" `
Adultactivity omitnull.Val[enums.FieldseekerQamosquitoinspectionNotinuitFEnum] `db:"adultactivity" `
Linelocid omitnull.Val[uuid.UUID] `db:"linelocid" `
Pointlocid omitnull.Val[uuid.UUID] `db:"pointlocid" `
Polygonlocid omitnull.Val[uuid.UUID] `db:"polygonlocid" `
CreatedUser omitnull.Val[string] `db:"created_user" `
CreatedDate omitnull.Val[time.Time] `db:"created_date" `
LastEditedUser omitnull.Val[string] `db:"last_edited_user" `
LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" `
Fieldtech omitnull.Val[string] `db:"fieldtech" `
Creationdate omitnull.Val[time.Time] `db:"creationdate" `
Creator omitnull.Val[string] `db:"creator" `
Editdate omitnull.Val[time.Time] `db:"editdate" `
Editor omitnull.Val[string] `db:"editor" `
Version omit.Val[int32] `db:"version,pk" `
Objectid omit.Val[int64] `db:"objectid,pk" `
Posdips omitnull.Val[int16] `db:"posdips" `
Actiontaken omitnull.Val[string] `db:"actiontaken" `
Comments omitnull.Val[string] `db:"comments" `
Avetemp omitnull.Val[float64] `db:"avetemp" `
Windspeed omitnull.Val[float64] `db:"windspeed" `
Raingauge omitnull.Val[float64] `db:"raingauge" `
Globalid omitnull.Val[uuid.UUID] `db:"globalid" `
Startdatetime omitnull.Val[time.Time] `db:"startdatetime" `
Enddatetime omitnull.Val[time.Time] `db:"enddatetime" `
Winddir omitnull.Val[string] `db:"winddir" `
Reviewed omitnull.Val[int16] `db:"reviewed" `
Reviewedby omitnull.Val[string] `db:"reviewedby" `
Revieweddate omitnull.Val[time.Time] `db:"revieweddate" `
Locationname omitnull.Val[string] `db:"locationname" `
Zone omitnull.Val[string] `db:"zone" `
Recordstatus omitnull.Val[int16] `db:"recordstatus" `
Zone2 omitnull.Val[string] `db:"zone2" `
LR omitnull.Val[int16] `db:"lr" `
Negdips omitnull.Val[int16] `db:"negdips" `
Totalacres omitnull.Val[float64] `db:"totalacres" `
Acresbreeding omitnull.Val[float64] `db:"acresbreeding" `
Fish omitnull.Val[int16] `db:"fish" `
Sitetype omitnull.Val[string] `db:"sitetype" `
Breedingpotential omitnull.Val[string] `db:"breedingpotential" `
Movingwater omitnull.Val[int16] `db:"movingwater" `
Nowaterever omitnull.Val[int16] `db:"nowaterever" `
Mosquitohabitat omitnull.Val[string] `db:"mosquitohabitat" `
Habvalue1 omitnull.Val[int16] `db:"habvalue1" `
Habvalue1percent omitnull.Val[int16] `db:"habvalue1percent" `
Habvalue2 omitnull.Val[int16] `db:"habvalue2" `
Habvalue2percent omitnull.Val[int16] `db:"habvalue2percent" `
Potential omitnull.Val[int16] `db:"potential" `
Larvaepresent omitnull.Val[int16] `db:"larvaepresent" `
Larvaeinsidetreatedarea omitnull.Val[int16] `db:"larvaeinsidetreatedarea" `
Larvaeoutsidetreatedarea omitnull.Val[int16] `db:"larvaeoutsidetreatedarea" `
Larvaereason omitnull.Val[string] `db:"larvaereason" `
Aquaticorganisms omitnull.Val[string] `db:"aquaticorganisms" `
Vegetation omitnull.Val[string] `db:"vegetation" `
Sourcereduction omitnull.Val[string] `db:"sourcereduction" `
Waterpresent omitnull.Val[int16] `db:"waterpresent" `
Watermovement1 omitnull.Val[string] `db:"watermovement1" `
Watermovement1percent omitnull.Val[int16] `db:"watermovement1percent" `
Watermovement2 omitnull.Val[string] `db:"watermovement2" `
Watermovement2percent omitnull.Val[int16] `db:"watermovement2percent" `
Soilconditions omitnull.Val[string] `db:"soilconditions" `
Waterduration omitnull.Val[string] `db:"waterduration" `
Watersource omitnull.Val[string] `db:"watersource" `
Waterconditions omitnull.Val[string] `db:"waterconditions" `
Adultactivity omitnull.Val[int16] `db:"adultactivity" `
Linelocid omitnull.Val[uuid.UUID] `db:"linelocid" `
Pointlocid omitnull.Val[uuid.UUID] `db:"pointlocid" `
Polygonlocid omitnull.Val[uuid.UUID] `db:"polygonlocid" `
CreatedUser omitnull.Val[string] `db:"created_user" `
CreatedDate omitnull.Val[time.Time] `db:"created_date" `
LastEditedUser omitnull.Val[string] `db:"last_edited_user" `
LastEditedDate omitnull.Val[time.Time] `db:"last_edited_date" `
Fieldtech omitnull.Val[string] `db:"fieldtech" `
Creationdate omitnull.Val[time.Time] `db:"creationdate" `
Creator omitnull.Val[string] `db:"creator" `
Editdate omitnull.Val[time.Time] `db:"editdate" `
Editor omitnull.Val[string] `db:"editor" `
Geometry omit.Val[types.JSON[json.RawMessage]] `db:"geometry" `
Geospatial omitnull.Val[string] `db:"geospatial" `
Version omit.Val[int32] `db:"version,pk" `
OrganizationID omit.Val[int32] `db:"organization_id" `
}
func (s FieldseekerQamosquitoinspectionSetter) SetColumns() []string {
vals := make([]string, 0, 63)
vals := make([]string, 0, 66)
if s.Objectid.IsValue() {
vals = append(vals, "objectid")
}
@ -547,9 +589,18 @@ func (s FieldseekerQamosquitoinspectionSetter) SetColumns() []string {
if !s.Editor.IsUnset() {
vals = append(vals, "editor")
}
if s.Geometry.IsValue() {
vals = append(vals, "geometry")
}
if !s.Geospatial.IsUnset() {
vals = append(vals, "geospatial")
}
if s.Version.IsValue() {
vals = append(vals, "version")
}
if s.OrganizationID.IsValue() {
vals = append(vals, "organization_id")
}
return vals
}
@ -740,9 +791,18 @@ func (s FieldseekerQamosquitoinspectionSetter) Overwrite(t *FieldseekerQamosquit
if !s.Editor.IsUnset() {
t.Editor = s.Editor.MustGetNull()
}
if s.Geometry.IsValue() {
t.Geometry = s.Geometry.MustGet()
}
if !s.Geospatial.IsUnset() {
t.Geospatial = s.Geospatial.MustGetNull()
}
if s.Version.IsValue() {
t.Version = s.Version.MustGet()
}
if s.OrganizationID.IsValue() {
t.OrganizationID = s.OrganizationID.MustGet()
}
}
func (s *FieldseekerQamosquitoinspectionSetter) Apply(q *dialect.InsertQuery) {
@ -751,7 +811,7 @@ func (s *FieldseekerQamosquitoinspectionSetter) Apply(q *dialect.InsertQuery) {
})
q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
vals := make([]bob.Expression, 63)
vals := make([]bob.Expression, 66)
if s.Objectid.IsValue() {
vals[0] = psql.Arg(s.Objectid.MustGet())
} else {
@ -1124,12 +1184,30 @@ func (s *FieldseekerQamosquitoinspectionSetter) Apply(q *dialect.InsertQuery) {
vals[61] = psql.Raw("DEFAULT")
}
if s.Version.IsValue() {
vals[62] = psql.Arg(s.Version.MustGet())
if s.Geometry.IsValue() {
vals[62] = psql.Arg(s.Geometry.MustGet())
} else {
vals[62] = psql.Raw("DEFAULT")
}
if !s.Geospatial.IsUnset() {
vals[63] = psql.Arg(s.Geospatial.MustGetNull())
} else {
vals[63] = psql.Raw("DEFAULT")
}
if s.Version.IsValue() {
vals[64] = psql.Arg(s.Version.MustGet())
} else {
vals[64] = psql.Raw("DEFAULT")
}
if s.OrganizationID.IsValue() {
vals[65] = psql.Arg(s.OrganizationID.MustGet())
} else {
vals[65] = psql.Raw("DEFAULT")
}
return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "")
}))
}
@ -1139,7 +1217,7 @@ func (s FieldseekerQamosquitoinspectionSetter) UpdateMod() bob.Mod[*dialect.Upda
}
func (s FieldseekerQamosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expression {
exprs := make([]bob.Expression, 0, 63)
exprs := make([]bob.Expression, 0, 66)
if s.Objectid.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
@ -1575,6 +1653,20 @@ func (s FieldseekerQamosquitoinspectionSetter) Expressions(prefix ...string) []b
}})
}
if s.Geometry.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "geometry")...),
psql.Arg(s.Geometry),
}})
}
if !s.Geospatial.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "geospatial")...),
psql.Arg(s.Geospatial),
}})
}
if s.Version.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "version")...),
@ -1582,6 +1674,13 @@ func (s FieldseekerQamosquitoinspectionSetter) Expressions(prefix ...string) []b
}})
}
if s.OrganizationID.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "organization_id")...),
psql.Arg(s.OrganizationID),
}})
}
return exprs
}
@ -1649,6 +1748,7 @@ func (o *FieldseekerQamosquitoinspection) Update(ctx context.Context, exec bob.E
return err
}
o.R = v.R
*o = *v
return nil
@ -1669,7 +1769,7 @@ func (o *FieldseekerQamosquitoinspection) Reload(ctx context.Context, exec bob.E
if err != nil {
return err
}
o2.R = o.R
*o = *o2
return nil
@ -1719,7 +1819,7 @@ func (o FieldseekerQamosquitoinspectionSlice) copyMatchingRows(from ...*Fieldsee
if new.Version != old.Version {
continue
}
new.R = old.R
o[i] = new
break
}
@ -1817,10 +1917,82 @@ func (o FieldseekerQamosquitoinspectionSlice) ReloadAll(ctx context.Context, exe
return nil
}
// Organization starts a query for related objects on organization
func (o *FieldseekerQamosquitoinspection) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery {
return Organizations.Query(append(mods,
sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))),
)...)
}
func (os FieldseekerQamosquitoinspectionSlice) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery {
pkOrganizationID := make(pgtypes.Array[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)),
)...)
}
func attachFieldseekerQamosquitoinspectionOrganization0(ctx context.Context, exec bob.Executor, count int, fieldseekerQamosquitoinspection0 *FieldseekerQamosquitoinspection, organization1 *Organization) (*FieldseekerQamosquitoinspection, error) {
setter := &FieldseekerQamosquitoinspectionSetter{
OrganizationID: omit.From(organization1.ID),
}
err := fieldseekerQamosquitoinspection0.Update(ctx, exec, setter)
if err != nil {
return nil, fmt.Errorf("attachFieldseekerQamosquitoinspectionOrganization0: %w", err)
}
return fieldseekerQamosquitoinspection0, nil
}
func (fieldseekerQamosquitoinspection0 *FieldseekerQamosquitoinspection) InsertOrganization(ctx context.Context, exec bob.Executor, related *OrganizationSetter) error {
var err error
organization1, err := Organizations.Insert(related).One(ctx, exec)
if err != nil {
return fmt.Errorf("inserting related objects: %w", err)
}
_, err = attachFieldseekerQamosquitoinspectionOrganization0(ctx, exec, 1, fieldseekerQamosquitoinspection0, organization1)
if err != nil {
return err
}
fieldseekerQamosquitoinspection0.R.Organization = organization1
organization1.R.Qamosquitoinspections = append(organization1.R.Qamosquitoinspections, fieldseekerQamosquitoinspection0)
return nil
}
func (fieldseekerQamosquitoinspection0 *FieldseekerQamosquitoinspection) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error {
var err error
_, err = attachFieldseekerQamosquitoinspectionOrganization0(ctx, exec, 1, fieldseekerQamosquitoinspection0, organization1)
if err != nil {
return err
}
fieldseekerQamosquitoinspection0.R.Organization = organization1
organization1.R.Qamosquitoinspections = append(organization1.R.Qamosquitoinspections, fieldseekerQamosquitoinspection0)
return nil
}
type fieldseekerQamosquitoinspectionWhere[Q psql.Filterable] struct {
Objectid psql.WhereMod[Q, int64]
Posdips psql.WhereNullMod[Q, int16]
Actiontaken psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionMosquitoactionEnum]
Actiontaken psql.WhereNullMod[Q, string]
Comments psql.WhereNullMod[Q, string]
Avetemp psql.WhereNullMod[Q, float64]
Windspeed psql.WhereNullMod[Q, float64]
@ -1829,7 +2001,7 @@ type fieldseekerQamosquitoinspectionWhere[Q psql.Filterable] struct {
Startdatetime psql.WhereNullMod[Q, time.Time]
Enddatetime psql.WhereNullMod[Q, time.Time]
Winddir psql.WhereNullMod[Q, string]
Reviewed psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum]
Reviewed psql.WhereNullMod[Q, int16]
Reviewedby psql.WhereNullMod[Q, string]
Revieweddate psql.WhereNullMod[Q, time.Time]
Locationname psql.WhereNullMod[Q, string]
@ -1840,34 +2012,34 @@ type fieldseekerQamosquitoinspectionWhere[Q psql.Filterable] struct {
Negdips psql.WhereNullMod[Q, int16]
Totalacres psql.WhereNullMod[Q, float64]
Acresbreeding psql.WhereNullMod[Q, float64]
Fish psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum]
Sitetype psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQasitetypeEnum]
Breedingpotential psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum]
Movingwater psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum]
Nowaterever psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum]
Mosquitohabitat psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum]
Fish psql.WhereNullMod[Q, int16]
Sitetype psql.WhereNullMod[Q, string]
Breedingpotential psql.WhereNullMod[Q, string]
Movingwater psql.WhereNullMod[Q, int16]
Nowaterever psql.WhereNullMod[Q, int16]
Mosquitohabitat psql.WhereNullMod[Q, string]
Habvalue1 psql.WhereNullMod[Q, int16]
Habvalue1percent psql.WhereNullMod[Q, int16]
Habvalue2 psql.WhereNullMod[Q, int16]
Habvalue2percent psql.WhereNullMod[Q, int16]
Potential psql.WhereNullMod[Q, int16]
Larvaepresent psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum]
Larvaeinsidetreatedarea psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum]
Larvaeoutsidetreatedarea psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum]
Larvaereason psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum]
Aquaticorganisms psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum]
Vegetation psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQavegetationEnum]
Sourcereduction psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQasourcereductionEnum]
Waterpresent psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum]
Watermovement1 psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQawatermovementEnum]
Larvaepresent psql.WhereNullMod[Q, int16]
Larvaeinsidetreatedarea psql.WhereNullMod[Q, int16]
Larvaeoutsidetreatedarea psql.WhereNullMod[Q, int16]
Larvaereason psql.WhereNullMod[Q, string]
Aquaticorganisms psql.WhereNullMod[Q, string]
Vegetation psql.WhereNullMod[Q, string]
Sourcereduction psql.WhereNullMod[Q, string]
Waterpresent psql.WhereNullMod[Q, int16]
Watermovement1 psql.WhereNullMod[Q, string]
Watermovement1percent psql.WhereNullMod[Q, int16]
Watermovement2 psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQawatermovementEnum]
Watermovement2 psql.WhereNullMod[Q, string]
Watermovement2percent psql.WhereNullMod[Q, int16]
Soilconditions psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQasoilconditionEnum]
Waterduration psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQawaterdurationEnum]
Watersource psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQawatersourceEnum]
Waterconditions psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum]
Adultactivity psql.WhereNullMod[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum]
Soilconditions psql.WhereNullMod[Q, string]
Waterduration psql.WhereNullMod[Q, string]
Watersource psql.WhereNullMod[Q, string]
Waterconditions psql.WhereNullMod[Q, string]
Adultactivity psql.WhereNullMod[Q, int16]
Linelocid psql.WhereNullMod[Q, uuid.UUID]
Pointlocid psql.WhereNullMod[Q, uuid.UUID]
Polygonlocid psql.WhereNullMod[Q, uuid.UUID]
@ -1880,7 +2052,10 @@ type fieldseekerQamosquitoinspectionWhere[Q psql.Filterable] struct {
Creator psql.WhereNullMod[Q, string]
Editdate psql.WhereNullMod[Q, time.Time]
Editor psql.WhereNullMod[Q, string]
Geometry psql.WhereMod[Q, types.JSON[json.RawMessage]]
Geospatial psql.WhereNullMod[Q, string]
Version psql.WhereMod[Q, int32]
OrganizationID psql.WhereMod[Q, int32]
}
func (fieldseekerQamosquitoinspectionWhere[Q]) AliasedAs(alias string) fieldseekerQamosquitoinspectionWhere[Q] {
@ -1891,7 +2066,7 @@ func buildFieldseekerQamosquitoinspectionWhere[Q psql.Filterable](cols fieldseek
return fieldseekerQamosquitoinspectionWhere[Q]{
Objectid: psql.Where[Q, int64](cols.Objectid),
Posdips: psql.WhereNull[Q, int16](cols.Posdips),
Actiontaken: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionMosquitoactionEnum](cols.Actiontaken),
Actiontaken: psql.WhereNull[Q, string](cols.Actiontaken),
Comments: psql.WhereNull[Q, string](cols.Comments),
Avetemp: psql.WhereNull[Q, float64](cols.Avetemp),
Windspeed: psql.WhereNull[Q, float64](cols.Windspeed),
@ -1900,7 +2075,7 @@ func buildFieldseekerQamosquitoinspectionWhere[Q psql.Filterable](cols fieldseek
Startdatetime: psql.WhereNull[Q, time.Time](cols.Startdatetime),
Enddatetime: psql.WhereNull[Q, time.Time](cols.Enddatetime),
Winddir: psql.WhereNull[Q, string](cols.Winddir),
Reviewed: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum](cols.Reviewed),
Reviewed: psql.WhereNull[Q, int16](cols.Reviewed),
Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby),
Revieweddate: psql.WhereNull[Q, time.Time](cols.Revieweddate),
Locationname: psql.WhereNull[Q, string](cols.Locationname),
@ -1911,34 +2086,34 @@ func buildFieldseekerQamosquitoinspectionWhere[Q psql.Filterable](cols fieldseek
Negdips: psql.WhereNull[Q, int16](cols.Negdips),
Totalacres: psql.WhereNull[Q, float64](cols.Totalacres),
Acresbreeding: psql.WhereNull[Q, float64](cols.Acresbreeding),
Fish: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum](cols.Fish),
Sitetype: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQasitetypeEnum](cols.Sitetype),
Breedingpotential: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQabreedingpotentialEnum](cols.Breedingpotential),
Movingwater: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum](cols.Movingwater),
Nowaterever: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum](cols.Nowaterever),
Mosquitohabitat: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQamosquitohabitatEnum](cols.Mosquitohabitat),
Fish: psql.WhereNull[Q, int16](cols.Fish),
Sitetype: psql.WhereNull[Q, string](cols.Sitetype),
Breedingpotential: psql.WhereNull[Q, string](cols.Breedingpotential),
Movingwater: psql.WhereNull[Q, int16](cols.Movingwater),
Nowaterever: psql.WhereNull[Q, int16](cols.Nowaterever),
Mosquitohabitat: psql.WhereNull[Q, string](cols.Mosquitohabitat),
Habvalue1: psql.WhereNull[Q, int16](cols.Habvalue1),
Habvalue1percent: psql.WhereNull[Q, int16](cols.Habvalue1percent),
Habvalue2: psql.WhereNull[Q, int16](cols.Habvalue2),
Habvalue2percent: psql.WhereNull[Q, int16](cols.Habvalue2percent),
Potential: psql.WhereNull[Q, int16](cols.Potential),
Larvaepresent: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum](cols.Larvaepresent),
Larvaeinsidetreatedarea: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum](cols.Larvaeinsidetreatedarea),
Larvaeoutsidetreatedarea: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum](cols.Larvaeoutsidetreatedarea),
Larvaereason: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQalarvaereasonEnum](cols.Larvaereason),
Aquaticorganisms: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQaaquaticorganismsEnum](cols.Aquaticorganisms),
Vegetation: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQavegetationEnum](cols.Vegetation),
Sourcereduction: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQasourcereductionEnum](cols.Sourcereduction),
Waterpresent: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum](cols.Waterpresent),
Watermovement1: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQawatermovementEnum](cols.Watermovement1),
Larvaepresent: psql.WhereNull[Q, int16](cols.Larvaepresent),
Larvaeinsidetreatedarea: psql.WhereNull[Q, int16](cols.Larvaeinsidetreatedarea),
Larvaeoutsidetreatedarea: psql.WhereNull[Q, int16](cols.Larvaeoutsidetreatedarea),
Larvaereason: psql.WhereNull[Q, string](cols.Larvaereason),
Aquaticorganisms: psql.WhereNull[Q, string](cols.Aquaticorganisms),
Vegetation: psql.WhereNull[Q, string](cols.Vegetation),
Sourcereduction: psql.WhereNull[Q, string](cols.Sourcereduction),
Waterpresent: psql.WhereNull[Q, int16](cols.Waterpresent),
Watermovement1: psql.WhereNull[Q, string](cols.Watermovement1),
Watermovement1percent: psql.WhereNull[Q, int16](cols.Watermovement1percent),
Watermovement2: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQawatermovementEnum](cols.Watermovement2),
Watermovement2: psql.WhereNull[Q, string](cols.Watermovement2),
Watermovement2percent: psql.WhereNull[Q, int16](cols.Watermovement2percent),
Soilconditions: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQasoilconditionEnum](cols.Soilconditions),
Waterduration: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQawaterdurationEnum](cols.Waterduration),
Watersource: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQawatersourceEnum](cols.Watersource),
Waterconditions: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionQawaterconditionsEnum](cols.Waterconditions),
Adultactivity: psql.WhereNull[Q, enums.FieldseekerQamosquitoinspectionNotinuitFEnum](cols.Adultactivity),
Soilconditions: psql.WhereNull[Q, string](cols.Soilconditions),
Waterduration: psql.WhereNull[Q, string](cols.Waterduration),
Watersource: psql.WhereNull[Q, string](cols.Watersource),
Waterconditions: psql.WhereNull[Q, string](cols.Waterconditions),
Adultactivity: psql.WhereNull[Q, int16](cols.Adultactivity),
Linelocid: psql.WhereNull[Q, uuid.UUID](cols.Linelocid),
Pointlocid: psql.WhereNull[Q, uuid.UUID](cols.Pointlocid),
Polygonlocid: psql.WhereNull[Q, uuid.UUID](cols.Polygonlocid),
@ -1951,6 +2126,154 @@ func buildFieldseekerQamosquitoinspectionWhere[Q psql.Filterable](cols fieldseek
Creator: psql.WhereNull[Q, string](cols.Creator),
Editdate: psql.WhereNull[Q, time.Time](cols.Editdate),
Editor: psql.WhereNull[Q, string](cols.Editor),
Geometry: psql.Where[Q, types.JSON[json.RawMessage]](cols.Geometry),
Geospatial: psql.WhereNull[Q, string](cols.Geospatial),
Version: psql.Where[Q, int32](cols.Version),
OrganizationID: psql.Where[Q, int32](cols.OrganizationID),
}
}
func (o *FieldseekerQamosquitoinspection) Preload(name string, retrieved any) error {
if o == nil {
return nil
}
switch name {
case "Organization":
rel, ok := retrieved.(*Organization)
if !ok {
return fmt.Errorf("fieldseekerQamosquitoinspection cannot load %T as %q", retrieved, name)
}
o.R.Organization = rel
if rel != nil {
rel.R.Qamosquitoinspections = FieldseekerQamosquitoinspectionSlice{o}
}
return nil
default:
return fmt.Errorf("fieldseekerQamosquitoinspection has no relationship %q", name)
}
}
type fieldseekerQamosquitoinspectionPreloader struct {
Organization func(...psql.PreloadOption) psql.Preloader
}
func buildFieldseekerQamosquitoinspectionPreloader() fieldseekerQamosquitoinspectionPreloader {
return fieldseekerQamosquitoinspectionPreloader{
Organization: func(opts ...psql.PreloadOption) psql.Preloader {
return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{
Name: "Organization",
Sides: []psql.PreloadSide{
{
From: FieldseekerQamosquitoinspections,
To: Organizations,
FromColumns: []string{"organization_id"},
ToColumns: []string{"id"},
},
},
}, Organizations.Columns.Names(), opts...)
},
}
}
type fieldseekerQamosquitoinspectionThenLoader[Q orm.Loadable] struct {
Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
}
func buildFieldseekerQamosquitoinspectionThenLoader[Q orm.Loadable]() fieldseekerQamosquitoinspectionThenLoader[Q] {
type OrganizationLoadInterface interface {
LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
}
return fieldseekerQamosquitoinspectionThenLoader[Q]{
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...)
},
),
}
}
// LoadOrganization loads the fieldseekerQamosquitoinspection's Organization into the .R struct
func (o *FieldseekerQamosquitoinspection) LoadOrganization(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
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
}
related.R.Qamosquitoinspections = FieldseekerQamosquitoinspectionSlice{o}
o.R.Organization = related
return nil
}
// LoadOrganization loads the fieldseekerQamosquitoinspection's Organization into the .R struct
func (os FieldseekerQamosquitoinspectionSlice) LoadOrganization(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
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 == rel.ID) {
continue
}
rel.R.Qamosquitoinspections = append(rel.R.Qamosquitoinspections, o)
o.R.Organization = rel
break
}
}
return nil
}
type fieldseekerQamosquitoinspectionJoins[Q dialect.Joinable] struct {
typ string
Organization modAs[Q, organizationColumns]
}
func (j fieldseekerQamosquitoinspectionJoins[Q]) aliasedAs(alias string) fieldseekerQamosquitoinspectionJoins[Q] {
return buildFieldseekerQamosquitoinspectionJoins[Q](buildFieldseekerQamosquitoinspectionColumns(alias), j.typ)
}
func buildFieldseekerQamosquitoinspectionJoins[Q dialect.Joinable](cols fieldseekerQamosquitoinspectionColumns, typ string) fieldseekerQamosquitoinspectionJoins[Q] {
return fieldseekerQamosquitoinspectionJoins[Q]{
typ: typ,
Organization: modAs[Q, organizationColumns]{
c: Organizations.Columns,
f: func(to organizationColumns) bob.Mod[Q] {
mods := make(mods.QueryMods[Q], 0, 1)
{
mods = append(mods, dialect.Join[Q](typ, Organizations.Name().As(to.Alias())).On(
to.ID.EQ(cols.OrganizationID),
))
}
return mods
},
},
}
}