nidus-sync/models/history_qamosquitoinspection.bob.go
Eli Ribble b0432f3243
Add statistics on the sync and save org ID with fieldseeker tables
We need the org ID so that we can avoid bleedover between different
organizations.
2025-11-07 09:30:31 +00:00

2240 lines
75 KiB
Go

// Code generated by BobGen psql v0.41.1. 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"
"time"
"github.com/aarondl/opt/null"
"github.com/aarondl/opt/omit"
"github.com/aarondl/opt/omitnull"
"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"
)
// HistoryQamosquitoinspection is an object representing the database table.
type HistoryQamosquitoinspection struct {
OrganizationID int32 `db:"organization_id" `
Acresbreeding null.Val[float64] `db:"acresbreeding" `
Actiontaken null.Val[string] `db:"actiontaken" `
Adultactivity null.Val[int16] `db:"adultactivity" `
Aquaticorganisms null.Val[string] `db:"aquaticorganisms" `
Avetemp null.Val[float64] `db:"avetemp" `
Breedingpotential null.Val[string] `db:"breedingpotential" `
Comments null.Val[string] `db:"comments" `
Creationdate null.Val[int64] `db:"creationdate" `
Creator null.Val[string] `db:"creator" `
Enddatetime null.Val[int64] `db:"enddatetime" `
Editdate null.Val[int64] `db:"editdate" `
Editor null.Val[string] `db:"editor" `
Fieldtech null.Val[string] `db:"fieldtech" `
Fish null.Val[int16] `db:"fish" `
Globalid null.Val[string] `db:"globalid" `
Habvalue1 null.Val[int16] `db:"habvalue1" `
Habvalue1percent null.Val[int16] `db:"habvalue1percent" `
Habvalue2 null.Val[int16] `db:"habvalue2" `
Habvalue2percent null.Val[int16] `db:"habvalue2percent" `
Larvaeinsidetreatedarea null.Val[int16] `db:"larvaeinsidetreatedarea" `
Larvaeoutsidetreatedarea null.Val[int16] `db:"larvaeoutsidetreatedarea" `
Larvaepresent null.Val[int16] `db:"larvaepresent" `
Larvaereason null.Val[string] `db:"larvaereason" `
Linelocid null.Val[string] `db:"linelocid" `
Locationname null.Val[string] `db:"locationname" `
LR null.Val[int16] `db:"lr" `
Mosquitohabitat null.Val[string] `db:"mosquitohabitat" `
Movingwater null.Val[int16] `db:"movingwater" `
Negdips null.Val[int16] `db:"negdips" `
Nowaterever null.Val[int16] `db:"nowaterever" `
Objectid int32 `db:"objectid,pk" `
Pointlocid null.Val[string] `db:"pointlocid" `
Polygonlocid null.Val[string] `db:"polygonlocid" `
Posdips null.Val[int16] `db:"posdips" `
Potential null.Val[int16] `db:"potential" `
Raingauge null.Val[float64] `db:"raingauge" `
Recordstatus null.Val[int16] `db:"recordstatus" `
Reviewed null.Val[int16] `db:"reviewed" `
Reviewedby null.Val[string] `db:"reviewedby" `
Revieweddate null.Val[int64] `db:"revieweddate" `
Sitetype null.Val[string] `db:"sitetype" `
Soilconditions null.Val[string] `db:"soilconditions" `
Sourcereduction null.Val[string] `db:"sourcereduction" `
Startdatetime null.Val[int64] `db:"startdatetime" `
Totalacres null.Val[float64] `db:"totalacres" `
Vegetation null.Val[string] `db:"vegetation" `
Waterconditions null.Val[string] `db:"waterconditions" `
Waterduration null.Val[string] `db:"waterduration" `
Watermovement1 null.Val[string] `db:"watermovement1" `
Watermovement1percent null.Val[int16] `db:"watermovement1percent" `
Watermovement2 null.Val[string] `db:"watermovement2" `
Watermovement2percent null.Val[int16] `db:"watermovement2percent" `
Waterpresent null.Val[int16] `db:"waterpresent" `
Watersource null.Val[string] `db:"watersource" `
Winddir null.Val[string] `db:"winddir" `
Windspeed null.Val[float64] `db:"windspeed" `
Zone null.Val[string] `db:"zone" `
Zone2 null.Val[string] `db:"zone2" `
Created null.Val[time.Time] `db:"created" `
CreatedDate null.Val[int64] `db:"created_date" `
CreatedUser null.Val[string] `db:"created_user" `
GeometryX null.Val[float64] `db:"geometry_x" `
GeometryY null.Val[float64] `db:"geometry_y" `
LastEditedDate null.Val[int64] `db:"last_edited_date" `
LastEditedUser null.Val[string] `db:"last_edited_user" `
Version int32 `db:"version,pk" `
R historyQamosquitoinspectionR `db:"-" `
}
// HistoryQamosquitoinspectionSlice is an alias for a slice of pointers to HistoryQamosquitoinspection.
// This should almost always be used instead of []*HistoryQamosquitoinspection.
type HistoryQamosquitoinspectionSlice []*HistoryQamosquitoinspection
// HistoryQamosquitoinspections contains methods to work with the history_qamosquitoinspection table
var HistoryQamosquitoinspections = psql.NewTablex[*HistoryQamosquitoinspection, HistoryQamosquitoinspectionSlice, *HistoryQamosquitoinspectionSetter]("", "history_qamosquitoinspection", buildHistoryQamosquitoinspectionColumns("history_qamosquitoinspection"))
// HistoryQamosquitoinspectionsQuery is a query on the history_qamosquitoinspection table
type HistoryQamosquitoinspectionsQuery = *psql.ViewQuery[*HistoryQamosquitoinspection, HistoryQamosquitoinspectionSlice]
// historyQamosquitoinspectionR is where relationships are stored.
type historyQamosquitoinspectionR struct {
Organization *Organization // history_qamosquitoinspection.history_qamosquitoinspection_organization_id_fkey
}
func buildHistoryQamosquitoinspectionColumns(alias string) historyQamosquitoinspectionColumns {
return historyQamosquitoinspectionColumns{
ColumnsExpr: expr.NewColumnsExpr(
"organization_id", "acresbreeding", "actiontaken", "adultactivity", "aquaticorganisms", "avetemp", "breedingpotential", "comments", "creationdate", "creator", "enddatetime", "editdate", "editor", "fieldtech", "fish", "globalid", "habvalue1", "habvalue1percent", "habvalue2", "habvalue2percent", "larvaeinsidetreatedarea", "larvaeoutsidetreatedarea", "larvaepresent", "larvaereason", "linelocid", "locationname", "lr", "mosquitohabitat", "movingwater", "negdips", "nowaterever", "objectid", "pointlocid", "polygonlocid", "posdips", "potential", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "sitetype", "soilconditions", "sourcereduction", "startdatetime", "totalacres", "vegetation", "waterconditions", "waterduration", "watermovement1", "watermovement1percent", "watermovement2", "watermovement2percent", "waterpresent", "watersource", "winddir", "windspeed", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "version",
).WithParent("history_qamosquitoinspection"),
tableAlias: alias,
OrganizationID: psql.Quote(alias, "organization_id"),
Acresbreeding: psql.Quote(alias, "acresbreeding"),
Actiontaken: psql.Quote(alias, "actiontaken"),
Adultactivity: psql.Quote(alias, "adultactivity"),
Aquaticorganisms: psql.Quote(alias, "aquaticorganisms"),
Avetemp: psql.Quote(alias, "avetemp"),
Breedingpotential: psql.Quote(alias, "breedingpotential"),
Comments: psql.Quote(alias, "comments"),
Creationdate: psql.Quote(alias, "creationdate"),
Creator: psql.Quote(alias, "creator"),
Enddatetime: psql.Quote(alias, "enddatetime"),
Editdate: psql.Quote(alias, "editdate"),
Editor: psql.Quote(alias, "editor"),
Fieldtech: psql.Quote(alias, "fieldtech"),
Fish: psql.Quote(alias, "fish"),
Globalid: psql.Quote(alias, "globalid"),
Habvalue1: psql.Quote(alias, "habvalue1"),
Habvalue1percent: psql.Quote(alias, "habvalue1percent"),
Habvalue2: psql.Quote(alias, "habvalue2"),
Habvalue2percent: psql.Quote(alias, "habvalue2percent"),
Larvaeinsidetreatedarea: psql.Quote(alias, "larvaeinsidetreatedarea"),
Larvaeoutsidetreatedarea: psql.Quote(alias, "larvaeoutsidetreatedarea"),
Larvaepresent: psql.Quote(alias, "larvaepresent"),
Larvaereason: psql.Quote(alias, "larvaereason"),
Linelocid: psql.Quote(alias, "linelocid"),
Locationname: psql.Quote(alias, "locationname"),
LR: psql.Quote(alias, "lr"),
Mosquitohabitat: psql.Quote(alias, "mosquitohabitat"),
Movingwater: psql.Quote(alias, "movingwater"),
Negdips: psql.Quote(alias, "negdips"),
Nowaterever: psql.Quote(alias, "nowaterever"),
Objectid: psql.Quote(alias, "objectid"),
Pointlocid: psql.Quote(alias, "pointlocid"),
Polygonlocid: psql.Quote(alias, "polygonlocid"),
Posdips: psql.Quote(alias, "posdips"),
Potential: psql.Quote(alias, "potential"),
Raingauge: psql.Quote(alias, "raingauge"),
Recordstatus: psql.Quote(alias, "recordstatus"),
Reviewed: psql.Quote(alias, "reviewed"),
Reviewedby: psql.Quote(alias, "reviewedby"),
Revieweddate: psql.Quote(alias, "revieweddate"),
Sitetype: psql.Quote(alias, "sitetype"),
Soilconditions: psql.Quote(alias, "soilconditions"),
Sourcereduction: psql.Quote(alias, "sourcereduction"),
Startdatetime: psql.Quote(alias, "startdatetime"),
Totalacres: psql.Quote(alias, "totalacres"),
Vegetation: psql.Quote(alias, "vegetation"),
Waterconditions: psql.Quote(alias, "waterconditions"),
Waterduration: psql.Quote(alias, "waterduration"),
Watermovement1: psql.Quote(alias, "watermovement1"),
Watermovement1percent: psql.Quote(alias, "watermovement1percent"),
Watermovement2: psql.Quote(alias, "watermovement2"),
Watermovement2percent: psql.Quote(alias, "watermovement2percent"),
Waterpresent: psql.Quote(alias, "waterpresent"),
Watersource: psql.Quote(alias, "watersource"),
Winddir: psql.Quote(alias, "winddir"),
Windspeed: psql.Quote(alias, "windspeed"),
Zone: psql.Quote(alias, "zone"),
Zone2: psql.Quote(alias, "zone2"),
Created: psql.Quote(alias, "created"),
CreatedDate: psql.Quote(alias, "created_date"),
CreatedUser: psql.Quote(alias, "created_user"),
GeometryX: psql.Quote(alias, "geometry_x"),
GeometryY: psql.Quote(alias, "geometry_y"),
LastEditedDate: psql.Quote(alias, "last_edited_date"),
LastEditedUser: psql.Quote(alias, "last_edited_user"),
Version: psql.Quote(alias, "version"),
}
}
type historyQamosquitoinspectionColumns struct {
expr.ColumnsExpr
tableAlias string
OrganizationID psql.Expression
Acresbreeding psql.Expression
Actiontaken psql.Expression
Adultactivity psql.Expression
Aquaticorganisms psql.Expression
Avetemp psql.Expression
Breedingpotential psql.Expression
Comments psql.Expression
Creationdate psql.Expression
Creator psql.Expression
Enddatetime psql.Expression
Editdate psql.Expression
Editor psql.Expression
Fieldtech psql.Expression
Fish psql.Expression
Globalid psql.Expression
Habvalue1 psql.Expression
Habvalue1percent psql.Expression
Habvalue2 psql.Expression
Habvalue2percent psql.Expression
Larvaeinsidetreatedarea psql.Expression
Larvaeoutsidetreatedarea psql.Expression
Larvaepresent psql.Expression
Larvaereason psql.Expression
Linelocid psql.Expression
Locationname psql.Expression
LR psql.Expression
Mosquitohabitat psql.Expression
Movingwater psql.Expression
Negdips psql.Expression
Nowaterever psql.Expression
Objectid psql.Expression
Pointlocid psql.Expression
Polygonlocid psql.Expression
Posdips psql.Expression
Potential psql.Expression
Raingauge psql.Expression
Recordstatus psql.Expression
Reviewed psql.Expression
Reviewedby psql.Expression
Revieweddate psql.Expression
Sitetype psql.Expression
Soilconditions psql.Expression
Sourcereduction psql.Expression
Startdatetime psql.Expression
Totalacres psql.Expression
Vegetation psql.Expression
Waterconditions psql.Expression
Waterduration psql.Expression
Watermovement1 psql.Expression
Watermovement1percent psql.Expression
Watermovement2 psql.Expression
Watermovement2percent psql.Expression
Waterpresent psql.Expression
Watersource psql.Expression
Winddir psql.Expression
Windspeed psql.Expression
Zone psql.Expression
Zone2 psql.Expression
Created psql.Expression
CreatedDate psql.Expression
CreatedUser psql.Expression
GeometryX psql.Expression
GeometryY psql.Expression
LastEditedDate psql.Expression
LastEditedUser psql.Expression
Version psql.Expression
}
func (c historyQamosquitoinspectionColumns) Alias() string {
return c.tableAlias
}
func (historyQamosquitoinspectionColumns) AliasedAs(alias string) historyQamosquitoinspectionColumns {
return buildHistoryQamosquitoinspectionColumns(alias)
}
// HistoryQamosquitoinspectionSetter is used for insert/upsert/update operations
// All values are optional, and do not have to be set
// Generated columns are not included
type HistoryQamosquitoinspectionSetter struct {
OrganizationID omit.Val[int32] `db:"organization_id" `
Acresbreeding omitnull.Val[float64] `db:"acresbreeding" `
Actiontaken omitnull.Val[string] `db:"actiontaken" `
Adultactivity omitnull.Val[int16] `db:"adultactivity" `
Aquaticorganisms omitnull.Val[string] `db:"aquaticorganisms" `
Avetemp omitnull.Val[float64] `db:"avetemp" `
Breedingpotential omitnull.Val[string] `db:"breedingpotential" `
Comments omitnull.Val[string] `db:"comments" `
Creationdate omitnull.Val[int64] `db:"creationdate" `
Creator omitnull.Val[string] `db:"creator" `
Enddatetime omitnull.Val[int64] `db:"enddatetime" `
Editdate omitnull.Val[int64] `db:"editdate" `
Editor omitnull.Val[string] `db:"editor" `
Fieldtech omitnull.Val[string] `db:"fieldtech" `
Fish omitnull.Val[int16] `db:"fish" `
Globalid omitnull.Val[string] `db:"globalid" `
Habvalue1 omitnull.Val[int16] `db:"habvalue1" `
Habvalue1percent omitnull.Val[int16] `db:"habvalue1percent" `
Habvalue2 omitnull.Val[int16] `db:"habvalue2" `
Habvalue2percent omitnull.Val[int16] `db:"habvalue2percent" `
Larvaeinsidetreatedarea omitnull.Val[int16] `db:"larvaeinsidetreatedarea" `
Larvaeoutsidetreatedarea omitnull.Val[int16] `db:"larvaeoutsidetreatedarea" `
Larvaepresent omitnull.Val[int16] `db:"larvaepresent" `
Larvaereason omitnull.Val[string] `db:"larvaereason" `
Linelocid omitnull.Val[string] `db:"linelocid" `
Locationname omitnull.Val[string] `db:"locationname" `
LR omitnull.Val[int16] `db:"lr" `
Mosquitohabitat omitnull.Val[string] `db:"mosquitohabitat" `
Movingwater omitnull.Val[int16] `db:"movingwater" `
Negdips omitnull.Val[int16] `db:"negdips" `
Nowaterever omitnull.Val[int16] `db:"nowaterever" `
Objectid omit.Val[int32] `db:"objectid,pk" `
Pointlocid omitnull.Val[string] `db:"pointlocid" `
Polygonlocid omitnull.Val[string] `db:"polygonlocid" `
Posdips omitnull.Val[int16] `db:"posdips" `
Potential omitnull.Val[int16] `db:"potential" `
Raingauge omitnull.Val[float64] `db:"raingauge" `
Recordstatus omitnull.Val[int16] `db:"recordstatus" `
Reviewed omitnull.Val[int16] `db:"reviewed" `
Reviewedby omitnull.Val[string] `db:"reviewedby" `
Revieweddate omitnull.Val[int64] `db:"revieweddate" `
Sitetype omitnull.Val[string] `db:"sitetype" `
Soilconditions omitnull.Val[string] `db:"soilconditions" `
Sourcereduction omitnull.Val[string] `db:"sourcereduction" `
Startdatetime omitnull.Val[int64] `db:"startdatetime" `
Totalacres omitnull.Val[float64] `db:"totalacres" `
Vegetation omitnull.Val[string] `db:"vegetation" `
Waterconditions omitnull.Val[string] `db:"waterconditions" `
Waterduration omitnull.Val[string] `db:"waterduration" `
Watermovement1 omitnull.Val[string] `db:"watermovement1" `
Watermovement1percent omitnull.Val[int16] `db:"watermovement1percent" `
Watermovement2 omitnull.Val[string] `db:"watermovement2" `
Watermovement2percent omitnull.Val[int16] `db:"watermovement2percent" `
Waterpresent omitnull.Val[int16] `db:"waterpresent" `
Watersource omitnull.Val[string] `db:"watersource" `
Winddir omitnull.Val[string] `db:"winddir" `
Windspeed omitnull.Val[float64] `db:"windspeed" `
Zone omitnull.Val[string] `db:"zone" `
Zone2 omitnull.Val[string] `db:"zone2" `
Created omitnull.Val[time.Time] `db:"created" `
CreatedDate omitnull.Val[int64] `db:"created_date" `
CreatedUser omitnull.Val[string] `db:"created_user" `
GeometryX omitnull.Val[float64] `db:"geometry_x" `
GeometryY omitnull.Val[float64] `db:"geometry_y" `
LastEditedDate omitnull.Val[int64] `db:"last_edited_date" `
LastEditedUser omitnull.Val[string] `db:"last_edited_user" `
Version omit.Val[int32] `db:"version,pk" `
}
func (s HistoryQamosquitoinspectionSetter) SetColumns() []string {
vals := make([]string, 0, 67)
if s.OrganizationID.IsValue() {
vals = append(vals, "organization_id")
}
if !s.Acresbreeding.IsUnset() {
vals = append(vals, "acresbreeding")
}
if !s.Actiontaken.IsUnset() {
vals = append(vals, "actiontaken")
}
if !s.Adultactivity.IsUnset() {
vals = append(vals, "adultactivity")
}
if !s.Aquaticorganisms.IsUnset() {
vals = append(vals, "aquaticorganisms")
}
if !s.Avetemp.IsUnset() {
vals = append(vals, "avetemp")
}
if !s.Breedingpotential.IsUnset() {
vals = append(vals, "breedingpotential")
}
if !s.Comments.IsUnset() {
vals = append(vals, "comments")
}
if !s.Creationdate.IsUnset() {
vals = append(vals, "creationdate")
}
if !s.Creator.IsUnset() {
vals = append(vals, "creator")
}
if !s.Enddatetime.IsUnset() {
vals = append(vals, "enddatetime")
}
if !s.Editdate.IsUnset() {
vals = append(vals, "editdate")
}
if !s.Editor.IsUnset() {
vals = append(vals, "editor")
}
if !s.Fieldtech.IsUnset() {
vals = append(vals, "fieldtech")
}
if !s.Fish.IsUnset() {
vals = append(vals, "fish")
}
if !s.Globalid.IsUnset() {
vals = append(vals, "globalid")
}
if !s.Habvalue1.IsUnset() {
vals = append(vals, "habvalue1")
}
if !s.Habvalue1percent.IsUnset() {
vals = append(vals, "habvalue1percent")
}
if !s.Habvalue2.IsUnset() {
vals = append(vals, "habvalue2")
}
if !s.Habvalue2percent.IsUnset() {
vals = append(vals, "habvalue2percent")
}
if !s.Larvaeinsidetreatedarea.IsUnset() {
vals = append(vals, "larvaeinsidetreatedarea")
}
if !s.Larvaeoutsidetreatedarea.IsUnset() {
vals = append(vals, "larvaeoutsidetreatedarea")
}
if !s.Larvaepresent.IsUnset() {
vals = append(vals, "larvaepresent")
}
if !s.Larvaereason.IsUnset() {
vals = append(vals, "larvaereason")
}
if !s.Linelocid.IsUnset() {
vals = append(vals, "linelocid")
}
if !s.Locationname.IsUnset() {
vals = append(vals, "locationname")
}
if !s.LR.IsUnset() {
vals = append(vals, "lr")
}
if !s.Mosquitohabitat.IsUnset() {
vals = append(vals, "mosquitohabitat")
}
if !s.Movingwater.IsUnset() {
vals = append(vals, "movingwater")
}
if !s.Negdips.IsUnset() {
vals = append(vals, "negdips")
}
if !s.Nowaterever.IsUnset() {
vals = append(vals, "nowaterever")
}
if s.Objectid.IsValue() {
vals = append(vals, "objectid")
}
if !s.Pointlocid.IsUnset() {
vals = append(vals, "pointlocid")
}
if !s.Polygonlocid.IsUnset() {
vals = append(vals, "polygonlocid")
}
if !s.Posdips.IsUnset() {
vals = append(vals, "posdips")
}
if !s.Potential.IsUnset() {
vals = append(vals, "potential")
}
if !s.Raingauge.IsUnset() {
vals = append(vals, "raingauge")
}
if !s.Recordstatus.IsUnset() {
vals = append(vals, "recordstatus")
}
if !s.Reviewed.IsUnset() {
vals = append(vals, "reviewed")
}
if !s.Reviewedby.IsUnset() {
vals = append(vals, "reviewedby")
}
if !s.Revieweddate.IsUnset() {
vals = append(vals, "revieweddate")
}
if !s.Sitetype.IsUnset() {
vals = append(vals, "sitetype")
}
if !s.Soilconditions.IsUnset() {
vals = append(vals, "soilconditions")
}
if !s.Sourcereduction.IsUnset() {
vals = append(vals, "sourcereduction")
}
if !s.Startdatetime.IsUnset() {
vals = append(vals, "startdatetime")
}
if !s.Totalacres.IsUnset() {
vals = append(vals, "totalacres")
}
if !s.Vegetation.IsUnset() {
vals = append(vals, "vegetation")
}
if !s.Waterconditions.IsUnset() {
vals = append(vals, "waterconditions")
}
if !s.Waterduration.IsUnset() {
vals = append(vals, "waterduration")
}
if !s.Watermovement1.IsUnset() {
vals = append(vals, "watermovement1")
}
if !s.Watermovement1percent.IsUnset() {
vals = append(vals, "watermovement1percent")
}
if !s.Watermovement2.IsUnset() {
vals = append(vals, "watermovement2")
}
if !s.Watermovement2percent.IsUnset() {
vals = append(vals, "watermovement2percent")
}
if !s.Waterpresent.IsUnset() {
vals = append(vals, "waterpresent")
}
if !s.Watersource.IsUnset() {
vals = append(vals, "watersource")
}
if !s.Winddir.IsUnset() {
vals = append(vals, "winddir")
}
if !s.Windspeed.IsUnset() {
vals = append(vals, "windspeed")
}
if !s.Zone.IsUnset() {
vals = append(vals, "zone")
}
if !s.Zone2.IsUnset() {
vals = append(vals, "zone2")
}
if !s.Created.IsUnset() {
vals = append(vals, "created")
}
if !s.CreatedDate.IsUnset() {
vals = append(vals, "created_date")
}
if !s.CreatedUser.IsUnset() {
vals = append(vals, "created_user")
}
if !s.GeometryX.IsUnset() {
vals = append(vals, "geometry_x")
}
if !s.GeometryY.IsUnset() {
vals = append(vals, "geometry_y")
}
if !s.LastEditedDate.IsUnset() {
vals = append(vals, "last_edited_date")
}
if !s.LastEditedUser.IsUnset() {
vals = append(vals, "last_edited_user")
}
if s.Version.IsValue() {
vals = append(vals, "version")
}
return vals
}
func (s HistoryQamosquitoinspectionSetter) Overwrite(t *HistoryQamosquitoinspection) {
if s.OrganizationID.IsValue() {
t.OrganizationID = s.OrganizationID.MustGet()
}
if !s.Acresbreeding.IsUnset() {
t.Acresbreeding = s.Acresbreeding.MustGetNull()
}
if !s.Actiontaken.IsUnset() {
t.Actiontaken = s.Actiontaken.MustGetNull()
}
if !s.Adultactivity.IsUnset() {
t.Adultactivity = s.Adultactivity.MustGetNull()
}
if !s.Aquaticorganisms.IsUnset() {
t.Aquaticorganisms = s.Aquaticorganisms.MustGetNull()
}
if !s.Avetemp.IsUnset() {
t.Avetemp = s.Avetemp.MustGetNull()
}
if !s.Breedingpotential.IsUnset() {
t.Breedingpotential = s.Breedingpotential.MustGetNull()
}
if !s.Comments.IsUnset() {
t.Comments = s.Comments.MustGetNull()
}
if !s.Creationdate.IsUnset() {
t.Creationdate = s.Creationdate.MustGetNull()
}
if !s.Creator.IsUnset() {
t.Creator = s.Creator.MustGetNull()
}
if !s.Enddatetime.IsUnset() {
t.Enddatetime = s.Enddatetime.MustGetNull()
}
if !s.Editdate.IsUnset() {
t.Editdate = s.Editdate.MustGetNull()
}
if !s.Editor.IsUnset() {
t.Editor = s.Editor.MustGetNull()
}
if !s.Fieldtech.IsUnset() {
t.Fieldtech = s.Fieldtech.MustGetNull()
}
if !s.Fish.IsUnset() {
t.Fish = s.Fish.MustGetNull()
}
if !s.Globalid.IsUnset() {
t.Globalid = s.Globalid.MustGetNull()
}
if !s.Habvalue1.IsUnset() {
t.Habvalue1 = s.Habvalue1.MustGetNull()
}
if !s.Habvalue1percent.IsUnset() {
t.Habvalue1percent = s.Habvalue1percent.MustGetNull()
}
if !s.Habvalue2.IsUnset() {
t.Habvalue2 = s.Habvalue2.MustGetNull()
}
if !s.Habvalue2percent.IsUnset() {
t.Habvalue2percent = s.Habvalue2percent.MustGetNull()
}
if !s.Larvaeinsidetreatedarea.IsUnset() {
t.Larvaeinsidetreatedarea = s.Larvaeinsidetreatedarea.MustGetNull()
}
if !s.Larvaeoutsidetreatedarea.IsUnset() {
t.Larvaeoutsidetreatedarea = s.Larvaeoutsidetreatedarea.MustGetNull()
}
if !s.Larvaepresent.IsUnset() {
t.Larvaepresent = s.Larvaepresent.MustGetNull()
}
if !s.Larvaereason.IsUnset() {
t.Larvaereason = s.Larvaereason.MustGetNull()
}
if !s.Linelocid.IsUnset() {
t.Linelocid = s.Linelocid.MustGetNull()
}
if !s.Locationname.IsUnset() {
t.Locationname = s.Locationname.MustGetNull()
}
if !s.LR.IsUnset() {
t.LR = s.LR.MustGetNull()
}
if !s.Mosquitohabitat.IsUnset() {
t.Mosquitohabitat = s.Mosquitohabitat.MustGetNull()
}
if !s.Movingwater.IsUnset() {
t.Movingwater = s.Movingwater.MustGetNull()
}
if !s.Negdips.IsUnset() {
t.Negdips = s.Negdips.MustGetNull()
}
if !s.Nowaterever.IsUnset() {
t.Nowaterever = s.Nowaterever.MustGetNull()
}
if s.Objectid.IsValue() {
t.Objectid = s.Objectid.MustGet()
}
if !s.Pointlocid.IsUnset() {
t.Pointlocid = s.Pointlocid.MustGetNull()
}
if !s.Polygonlocid.IsUnset() {
t.Polygonlocid = s.Polygonlocid.MustGetNull()
}
if !s.Posdips.IsUnset() {
t.Posdips = s.Posdips.MustGetNull()
}
if !s.Potential.IsUnset() {
t.Potential = s.Potential.MustGetNull()
}
if !s.Raingauge.IsUnset() {
t.Raingauge = s.Raingauge.MustGetNull()
}
if !s.Recordstatus.IsUnset() {
t.Recordstatus = s.Recordstatus.MustGetNull()
}
if !s.Reviewed.IsUnset() {
t.Reviewed = s.Reviewed.MustGetNull()
}
if !s.Reviewedby.IsUnset() {
t.Reviewedby = s.Reviewedby.MustGetNull()
}
if !s.Revieweddate.IsUnset() {
t.Revieweddate = s.Revieweddate.MustGetNull()
}
if !s.Sitetype.IsUnset() {
t.Sitetype = s.Sitetype.MustGetNull()
}
if !s.Soilconditions.IsUnset() {
t.Soilconditions = s.Soilconditions.MustGetNull()
}
if !s.Sourcereduction.IsUnset() {
t.Sourcereduction = s.Sourcereduction.MustGetNull()
}
if !s.Startdatetime.IsUnset() {
t.Startdatetime = s.Startdatetime.MustGetNull()
}
if !s.Totalacres.IsUnset() {
t.Totalacres = s.Totalacres.MustGetNull()
}
if !s.Vegetation.IsUnset() {
t.Vegetation = s.Vegetation.MustGetNull()
}
if !s.Waterconditions.IsUnset() {
t.Waterconditions = s.Waterconditions.MustGetNull()
}
if !s.Waterduration.IsUnset() {
t.Waterduration = s.Waterduration.MustGetNull()
}
if !s.Watermovement1.IsUnset() {
t.Watermovement1 = s.Watermovement1.MustGetNull()
}
if !s.Watermovement1percent.IsUnset() {
t.Watermovement1percent = s.Watermovement1percent.MustGetNull()
}
if !s.Watermovement2.IsUnset() {
t.Watermovement2 = s.Watermovement2.MustGetNull()
}
if !s.Watermovement2percent.IsUnset() {
t.Watermovement2percent = s.Watermovement2percent.MustGetNull()
}
if !s.Waterpresent.IsUnset() {
t.Waterpresent = s.Waterpresent.MustGetNull()
}
if !s.Watersource.IsUnset() {
t.Watersource = s.Watersource.MustGetNull()
}
if !s.Winddir.IsUnset() {
t.Winddir = s.Winddir.MustGetNull()
}
if !s.Windspeed.IsUnset() {
t.Windspeed = s.Windspeed.MustGetNull()
}
if !s.Zone.IsUnset() {
t.Zone = s.Zone.MustGetNull()
}
if !s.Zone2.IsUnset() {
t.Zone2 = s.Zone2.MustGetNull()
}
if !s.Created.IsUnset() {
t.Created = s.Created.MustGetNull()
}
if !s.CreatedDate.IsUnset() {
t.CreatedDate = s.CreatedDate.MustGetNull()
}
if !s.CreatedUser.IsUnset() {
t.CreatedUser = s.CreatedUser.MustGetNull()
}
if !s.GeometryX.IsUnset() {
t.GeometryX = s.GeometryX.MustGetNull()
}
if !s.GeometryY.IsUnset() {
t.GeometryY = s.GeometryY.MustGetNull()
}
if !s.LastEditedDate.IsUnset() {
t.LastEditedDate = s.LastEditedDate.MustGetNull()
}
if !s.LastEditedUser.IsUnset() {
t.LastEditedUser = s.LastEditedUser.MustGetNull()
}
if s.Version.IsValue() {
t.Version = s.Version.MustGet()
}
}
func (s *HistoryQamosquitoinspectionSetter) Apply(q *dialect.InsertQuery) {
q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) {
return HistoryQamosquitoinspections.BeforeInsertHooks.RunHooks(ctx, exec, s)
})
q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) {
vals := make([]bob.Expression, 67)
if s.OrganizationID.IsValue() {
vals[0] = psql.Arg(s.OrganizationID.MustGet())
} else {
vals[0] = psql.Raw("DEFAULT")
}
if !s.Acresbreeding.IsUnset() {
vals[1] = psql.Arg(s.Acresbreeding.MustGetNull())
} else {
vals[1] = psql.Raw("DEFAULT")
}
if !s.Actiontaken.IsUnset() {
vals[2] = psql.Arg(s.Actiontaken.MustGetNull())
} else {
vals[2] = psql.Raw("DEFAULT")
}
if !s.Adultactivity.IsUnset() {
vals[3] = psql.Arg(s.Adultactivity.MustGetNull())
} else {
vals[3] = psql.Raw("DEFAULT")
}
if !s.Aquaticorganisms.IsUnset() {
vals[4] = psql.Arg(s.Aquaticorganisms.MustGetNull())
} else {
vals[4] = psql.Raw("DEFAULT")
}
if !s.Avetemp.IsUnset() {
vals[5] = psql.Arg(s.Avetemp.MustGetNull())
} else {
vals[5] = psql.Raw("DEFAULT")
}
if !s.Breedingpotential.IsUnset() {
vals[6] = psql.Arg(s.Breedingpotential.MustGetNull())
} else {
vals[6] = psql.Raw("DEFAULT")
}
if !s.Comments.IsUnset() {
vals[7] = psql.Arg(s.Comments.MustGetNull())
} else {
vals[7] = psql.Raw("DEFAULT")
}
if !s.Creationdate.IsUnset() {
vals[8] = psql.Arg(s.Creationdate.MustGetNull())
} else {
vals[8] = psql.Raw("DEFAULT")
}
if !s.Creator.IsUnset() {
vals[9] = psql.Arg(s.Creator.MustGetNull())
} else {
vals[9] = psql.Raw("DEFAULT")
}
if !s.Enddatetime.IsUnset() {
vals[10] = psql.Arg(s.Enddatetime.MustGetNull())
} else {
vals[10] = psql.Raw("DEFAULT")
}
if !s.Editdate.IsUnset() {
vals[11] = psql.Arg(s.Editdate.MustGetNull())
} else {
vals[11] = psql.Raw("DEFAULT")
}
if !s.Editor.IsUnset() {
vals[12] = psql.Arg(s.Editor.MustGetNull())
} else {
vals[12] = psql.Raw("DEFAULT")
}
if !s.Fieldtech.IsUnset() {
vals[13] = psql.Arg(s.Fieldtech.MustGetNull())
} else {
vals[13] = psql.Raw("DEFAULT")
}
if !s.Fish.IsUnset() {
vals[14] = psql.Arg(s.Fish.MustGetNull())
} else {
vals[14] = psql.Raw("DEFAULT")
}
if !s.Globalid.IsUnset() {
vals[15] = psql.Arg(s.Globalid.MustGetNull())
} else {
vals[15] = psql.Raw("DEFAULT")
}
if !s.Habvalue1.IsUnset() {
vals[16] = psql.Arg(s.Habvalue1.MustGetNull())
} else {
vals[16] = psql.Raw("DEFAULT")
}
if !s.Habvalue1percent.IsUnset() {
vals[17] = psql.Arg(s.Habvalue1percent.MustGetNull())
} else {
vals[17] = psql.Raw("DEFAULT")
}
if !s.Habvalue2.IsUnset() {
vals[18] = psql.Arg(s.Habvalue2.MustGetNull())
} else {
vals[18] = psql.Raw("DEFAULT")
}
if !s.Habvalue2percent.IsUnset() {
vals[19] = psql.Arg(s.Habvalue2percent.MustGetNull())
} else {
vals[19] = psql.Raw("DEFAULT")
}
if !s.Larvaeinsidetreatedarea.IsUnset() {
vals[20] = psql.Arg(s.Larvaeinsidetreatedarea.MustGetNull())
} else {
vals[20] = psql.Raw("DEFAULT")
}
if !s.Larvaeoutsidetreatedarea.IsUnset() {
vals[21] = psql.Arg(s.Larvaeoutsidetreatedarea.MustGetNull())
} else {
vals[21] = psql.Raw("DEFAULT")
}
if !s.Larvaepresent.IsUnset() {
vals[22] = psql.Arg(s.Larvaepresent.MustGetNull())
} else {
vals[22] = psql.Raw("DEFAULT")
}
if !s.Larvaereason.IsUnset() {
vals[23] = psql.Arg(s.Larvaereason.MustGetNull())
} else {
vals[23] = psql.Raw("DEFAULT")
}
if !s.Linelocid.IsUnset() {
vals[24] = psql.Arg(s.Linelocid.MustGetNull())
} else {
vals[24] = psql.Raw("DEFAULT")
}
if !s.Locationname.IsUnset() {
vals[25] = psql.Arg(s.Locationname.MustGetNull())
} else {
vals[25] = psql.Raw("DEFAULT")
}
if !s.LR.IsUnset() {
vals[26] = psql.Arg(s.LR.MustGetNull())
} else {
vals[26] = psql.Raw("DEFAULT")
}
if !s.Mosquitohabitat.IsUnset() {
vals[27] = psql.Arg(s.Mosquitohabitat.MustGetNull())
} else {
vals[27] = psql.Raw("DEFAULT")
}
if !s.Movingwater.IsUnset() {
vals[28] = psql.Arg(s.Movingwater.MustGetNull())
} else {
vals[28] = psql.Raw("DEFAULT")
}
if !s.Negdips.IsUnset() {
vals[29] = psql.Arg(s.Negdips.MustGetNull())
} else {
vals[29] = psql.Raw("DEFAULT")
}
if !s.Nowaterever.IsUnset() {
vals[30] = psql.Arg(s.Nowaterever.MustGetNull())
} else {
vals[30] = psql.Raw("DEFAULT")
}
if s.Objectid.IsValue() {
vals[31] = psql.Arg(s.Objectid.MustGet())
} else {
vals[31] = psql.Raw("DEFAULT")
}
if !s.Pointlocid.IsUnset() {
vals[32] = psql.Arg(s.Pointlocid.MustGetNull())
} else {
vals[32] = psql.Raw("DEFAULT")
}
if !s.Polygonlocid.IsUnset() {
vals[33] = psql.Arg(s.Polygonlocid.MustGetNull())
} else {
vals[33] = psql.Raw("DEFAULT")
}
if !s.Posdips.IsUnset() {
vals[34] = psql.Arg(s.Posdips.MustGetNull())
} else {
vals[34] = psql.Raw("DEFAULT")
}
if !s.Potential.IsUnset() {
vals[35] = psql.Arg(s.Potential.MustGetNull())
} else {
vals[35] = psql.Raw("DEFAULT")
}
if !s.Raingauge.IsUnset() {
vals[36] = psql.Arg(s.Raingauge.MustGetNull())
} else {
vals[36] = psql.Raw("DEFAULT")
}
if !s.Recordstatus.IsUnset() {
vals[37] = psql.Arg(s.Recordstatus.MustGetNull())
} else {
vals[37] = psql.Raw("DEFAULT")
}
if !s.Reviewed.IsUnset() {
vals[38] = psql.Arg(s.Reviewed.MustGetNull())
} else {
vals[38] = psql.Raw("DEFAULT")
}
if !s.Reviewedby.IsUnset() {
vals[39] = psql.Arg(s.Reviewedby.MustGetNull())
} else {
vals[39] = psql.Raw("DEFAULT")
}
if !s.Revieweddate.IsUnset() {
vals[40] = psql.Arg(s.Revieweddate.MustGetNull())
} else {
vals[40] = psql.Raw("DEFAULT")
}
if !s.Sitetype.IsUnset() {
vals[41] = psql.Arg(s.Sitetype.MustGetNull())
} else {
vals[41] = psql.Raw("DEFAULT")
}
if !s.Soilconditions.IsUnset() {
vals[42] = psql.Arg(s.Soilconditions.MustGetNull())
} else {
vals[42] = psql.Raw("DEFAULT")
}
if !s.Sourcereduction.IsUnset() {
vals[43] = psql.Arg(s.Sourcereduction.MustGetNull())
} else {
vals[43] = psql.Raw("DEFAULT")
}
if !s.Startdatetime.IsUnset() {
vals[44] = psql.Arg(s.Startdatetime.MustGetNull())
} else {
vals[44] = psql.Raw("DEFAULT")
}
if !s.Totalacres.IsUnset() {
vals[45] = psql.Arg(s.Totalacres.MustGetNull())
} else {
vals[45] = psql.Raw("DEFAULT")
}
if !s.Vegetation.IsUnset() {
vals[46] = psql.Arg(s.Vegetation.MustGetNull())
} else {
vals[46] = psql.Raw("DEFAULT")
}
if !s.Waterconditions.IsUnset() {
vals[47] = psql.Arg(s.Waterconditions.MustGetNull())
} else {
vals[47] = psql.Raw("DEFAULT")
}
if !s.Waterduration.IsUnset() {
vals[48] = psql.Arg(s.Waterduration.MustGetNull())
} else {
vals[48] = psql.Raw("DEFAULT")
}
if !s.Watermovement1.IsUnset() {
vals[49] = psql.Arg(s.Watermovement1.MustGetNull())
} else {
vals[49] = psql.Raw("DEFAULT")
}
if !s.Watermovement1percent.IsUnset() {
vals[50] = psql.Arg(s.Watermovement1percent.MustGetNull())
} else {
vals[50] = psql.Raw("DEFAULT")
}
if !s.Watermovement2.IsUnset() {
vals[51] = psql.Arg(s.Watermovement2.MustGetNull())
} else {
vals[51] = psql.Raw("DEFAULT")
}
if !s.Watermovement2percent.IsUnset() {
vals[52] = psql.Arg(s.Watermovement2percent.MustGetNull())
} else {
vals[52] = psql.Raw("DEFAULT")
}
if !s.Waterpresent.IsUnset() {
vals[53] = psql.Arg(s.Waterpresent.MustGetNull())
} else {
vals[53] = psql.Raw("DEFAULT")
}
if !s.Watersource.IsUnset() {
vals[54] = psql.Arg(s.Watersource.MustGetNull())
} else {
vals[54] = psql.Raw("DEFAULT")
}
if !s.Winddir.IsUnset() {
vals[55] = psql.Arg(s.Winddir.MustGetNull())
} else {
vals[55] = psql.Raw("DEFAULT")
}
if !s.Windspeed.IsUnset() {
vals[56] = psql.Arg(s.Windspeed.MustGetNull())
} else {
vals[56] = psql.Raw("DEFAULT")
}
if !s.Zone.IsUnset() {
vals[57] = psql.Arg(s.Zone.MustGetNull())
} else {
vals[57] = psql.Raw("DEFAULT")
}
if !s.Zone2.IsUnset() {
vals[58] = psql.Arg(s.Zone2.MustGetNull())
} else {
vals[58] = psql.Raw("DEFAULT")
}
if !s.Created.IsUnset() {
vals[59] = psql.Arg(s.Created.MustGetNull())
} else {
vals[59] = psql.Raw("DEFAULT")
}
if !s.CreatedDate.IsUnset() {
vals[60] = psql.Arg(s.CreatedDate.MustGetNull())
} else {
vals[60] = psql.Raw("DEFAULT")
}
if !s.CreatedUser.IsUnset() {
vals[61] = psql.Arg(s.CreatedUser.MustGetNull())
} else {
vals[61] = psql.Raw("DEFAULT")
}
if !s.GeometryX.IsUnset() {
vals[62] = psql.Arg(s.GeometryX.MustGetNull())
} else {
vals[62] = psql.Raw("DEFAULT")
}
if !s.GeometryY.IsUnset() {
vals[63] = psql.Arg(s.GeometryY.MustGetNull())
} else {
vals[63] = psql.Raw("DEFAULT")
}
if !s.LastEditedDate.IsUnset() {
vals[64] = psql.Arg(s.LastEditedDate.MustGetNull())
} else {
vals[64] = psql.Raw("DEFAULT")
}
if !s.LastEditedUser.IsUnset() {
vals[65] = psql.Arg(s.LastEditedUser.MustGetNull())
} else {
vals[65] = psql.Raw("DEFAULT")
}
if s.Version.IsValue() {
vals[66] = psql.Arg(s.Version.MustGet())
} else {
vals[66] = psql.Raw("DEFAULT")
}
return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "")
}))
}
func (s HistoryQamosquitoinspectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] {
return um.Set(s.Expressions()...)
}
func (s HistoryQamosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expression {
exprs := make([]bob.Expression, 0, 67)
if s.OrganizationID.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "organization_id")...),
psql.Arg(s.OrganizationID),
}})
}
if !s.Acresbreeding.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "acresbreeding")...),
psql.Arg(s.Acresbreeding),
}})
}
if !s.Actiontaken.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "actiontaken")...),
psql.Arg(s.Actiontaken),
}})
}
if !s.Adultactivity.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "adultactivity")...),
psql.Arg(s.Adultactivity),
}})
}
if !s.Aquaticorganisms.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "aquaticorganisms")...),
psql.Arg(s.Aquaticorganisms),
}})
}
if !s.Avetemp.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "avetemp")...),
psql.Arg(s.Avetemp),
}})
}
if !s.Breedingpotential.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "breedingpotential")...),
psql.Arg(s.Breedingpotential),
}})
}
if !s.Comments.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "comments")...),
psql.Arg(s.Comments),
}})
}
if !s.Creationdate.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "creationdate")...),
psql.Arg(s.Creationdate),
}})
}
if !s.Creator.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "creator")...),
psql.Arg(s.Creator),
}})
}
if !s.Enddatetime.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "enddatetime")...),
psql.Arg(s.Enddatetime),
}})
}
if !s.Editdate.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "editdate")...),
psql.Arg(s.Editdate),
}})
}
if !s.Editor.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "editor")...),
psql.Arg(s.Editor),
}})
}
if !s.Fieldtech.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "fieldtech")...),
psql.Arg(s.Fieldtech),
}})
}
if !s.Fish.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "fish")...),
psql.Arg(s.Fish),
}})
}
if !s.Globalid.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "globalid")...),
psql.Arg(s.Globalid),
}})
}
if !s.Habvalue1.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "habvalue1")...),
psql.Arg(s.Habvalue1),
}})
}
if !s.Habvalue1percent.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "habvalue1percent")...),
psql.Arg(s.Habvalue1percent),
}})
}
if !s.Habvalue2.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "habvalue2")...),
psql.Arg(s.Habvalue2),
}})
}
if !s.Habvalue2percent.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "habvalue2percent")...),
psql.Arg(s.Habvalue2percent),
}})
}
if !s.Larvaeinsidetreatedarea.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "larvaeinsidetreatedarea")...),
psql.Arg(s.Larvaeinsidetreatedarea),
}})
}
if !s.Larvaeoutsidetreatedarea.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "larvaeoutsidetreatedarea")...),
psql.Arg(s.Larvaeoutsidetreatedarea),
}})
}
if !s.Larvaepresent.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "larvaepresent")...),
psql.Arg(s.Larvaepresent),
}})
}
if !s.Larvaereason.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "larvaereason")...),
psql.Arg(s.Larvaereason),
}})
}
if !s.Linelocid.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "linelocid")...),
psql.Arg(s.Linelocid),
}})
}
if !s.Locationname.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "locationname")...),
psql.Arg(s.Locationname),
}})
}
if !s.LR.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "lr")...),
psql.Arg(s.LR),
}})
}
if !s.Mosquitohabitat.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "mosquitohabitat")...),
psql.Arg(s.Mosquitohabitat),
}})
}
if !s.Movingwater.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "movingwater")...),
psql.Arg(s.Movingwater),
}})
}
if !s.Negdips.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "negdips")...),
psql.Arg(s.Negdips),
}})
}
if !s.Nowaterever.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "nowaterever")...),
psql.Arg(s.Nowaterever),
}})
}
if s.Objectid.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "objectid")...),
psql.Arg(s.Objectid),
}})
}
if !s.Pointlocid.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "pointlocid")...),
psql.Arg(s.Pointlocid),
}})
}
if !s.Polygonlocid.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "polygonlocid")...),
psql.Arg(s.Polygonlocid),
}})
}
if !s.Posdips.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "posdips")...),
psql.Arg(s.Posdips),
}})
}
if !s.Potential.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "potential")...),
psql.Arg(s.Potential),
}})
}
if !s.Raingauge.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "raingauge")...),
psql.Arg(s.Raingauge),
}})
}
if !s.Recordstatus.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "recordstatus")...),
psql.Arg(s.Recordstatus),
}})
}
if !s.Reviewed.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "reviewed")...),
psql.Arg(s.Reviewed),
}})
}
if !s.Reviewedby.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "reviewedby")...),
psql.Arg(s.Reviewedby),
}})
}
if !s.Revieweddate.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "revieweddate")...),
psql.Arg(s.Revieweddate),
}})
}
if !s.Sitetype.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "sitetype")...),
psql.Arg(s.Sitetype),
}})
}
if !s.Soilconditions.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "soilconditions")...),
psql.Arg(s.Soilconditions),
}})
}
if !s.Sourcereduction.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "sourcereduction")...),
psql.Arg(s.Sourcereduction),
}})
}
if !s.Startdatetime.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "startdatetime")...),
psql.Arg(s.Startdatetime),
}})
}
if !s.Totalacres.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "totalacres")...),
psql.Arg(s.Totalacres),
}})
}
if !s.Vegetation.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "vegetation")...),
psql.Arg(s.Vegetation),
}})
}
if !s.Waterconditions.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "waterconditions")...),
psql.Arg(s.Waterconditions),
}})
}
if !s.Waterduration.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "waterduration")...),
psql.Arg(s.Waterduration),
}})
}
if !s.Watermovement1.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "watermovement1")...),
psql.Arg(s.Watermovement1),
}})
}
if !s.Watermovement1percent.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "watermovement1percent")...),
psql.Arg(s.Watermovement1percent),
}})
}
if !s.Watermovement2.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "watermovement2")...),
psql.Arg(s.Watermovement2),
}})
}
if !s.Watermovement2percent.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "watermovement2percent")...),
psql.Arg(s.Watermovement2percent),
}})
}
if !s.Waterpresent.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "waterpresent")...),
psql.Arg(s.Waterpresent),
}})
}
if !s.Watersource.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "watersource")...),
psql.Arg(s.Watersource),
}})
}
if !s.Winddir.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "winddir")...),
psql.Arg(s.Winddir),
}})
}
if !s.Windspeed.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "windspeed")...),
psql.Arg(s.Windspeed),
}})
}
if !s.Zone.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "zone")...),
psql.Arg(s.Zone),
}})
}
if !s.Zone2.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "zone2")...),
psql.Arg(s.Zone2),
}})
}
if !s.Created.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "created")...),
psql.Arg(s.Created),
}})
}
if !s.CreatedDate.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "created_date")...),
psql.Arg(s.CreatedDate),
}})
}
if !s.CreatedUser.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "created_user")...),
psql.Arg(s.CreatedUser),
}})
}
if !s.GeometryX.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "geometry_x")...),
psql.Arg(s.GeometryX),
}})
}
if !s.GeometryY.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "geometry_y")...),
psql.Arg(s.GeometryY),
}})
}
if !s.LastEditedDate.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "last_edited_date")...),
psql.Arg(s.LastEditedDate),
}})
}
if !s.LastEditedUser.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "last_edited_user")...),
psql.Arg(s.LastEditedUser),
}})
}
if s.Version.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "version")...),
psql.Arg(s.Version),
}})
}
return exprs
}
// FindHistoryQamosquitoinspection retrieves a single record by primary key
// If cols is empty Find will return all columns.
func FindHistoryQamosquitoinspection(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryQamosquitoinspection, error) {
if len(cols) == 0 {
return HistoryQamosquitoinspections.Query(
sm.Where(HistoryQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
sm.Where(HistoryQamosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))),
).One(ctx, exec)
}
return HistoryQamosquitoinspections.Query(
sm.Where(HistoryQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
sm.Where(HistoryQamosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))),
sm.Columns(HistoryQamosquitoinspections.Columns.Only(cols...)),
).One(ctx, exec)
}
// HistoryQamosquitoinspectionExists checks the presence of a single record by primary key
func HistoryQamosquitoinspectionExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) {
return HistoryQamosquitoinspections.Query(
sm.Where(HistoryQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
sm.Where(HistoryQamosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))),
).Exists(ctx, exec)
}
// AfterQueryHook is called after HistoryQamosquitoinspection is retrieved from the database
func (o *HistoryQamosquitoinspection) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
var err error
switch queryType {
case bob.QueryTypeSelect:
ctx, err = HistoryQamosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, HistoryQamosquitoinspectionSlice{o})
case bob.QueryTypeInsert:
ctx, err = HistoryQamosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, HistoryQamosquitoinspectionSlice{o})
case bob.QueryTypeUpdate:
ctx, err = HistoryQamosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, HistoryQamosquitoinspectionSlice{o})
case bob.QueryTypeDelete:
ctx, err = HistoryQamosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, HistoryQamosquitoinspectionSlice{o})
}
return err
}
// primaryKeyVals returns the primary key values of the HistoryQamosquitoinspection
func (o *HistoryQamosquitoinspection) primaryKeyVals() bob.Expression {
return psql.ArgGroup(
o.Objectid,
o.Version,
)
}
func (o *HistoryQamosquitoinspection) pkEQ() dialect.Expression {
return psql.Group(psql.Quote("history_qamosquitoinspection", "objectid"), psql.Quote("history_qamosquitoinspection", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, d bob.Dialect, start int) ([]any, error) {
return o.primaryKeyVals().WriteSQL(ctx, w, d, start)
}))
}
// Update uses an executor to update the HistoryQamosquitoinspection
func (o *HistoryQamosquitoinspection) Update(ctx context.Context, exec bob.Executor, s *HistoryQamosquitoinspectionSetter) error {
v, err := HistoryQamosquitoinspections.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 HistoryQamosquitoinspection record with an executor
func (o *HistoryQamosquitoinspection) Delete(ctx context.Context, exec bob.Executor) error {
_, err := HistoryQamosquitoinspections.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec)
return err
}
// Reload refreshes the HistoryQamosquitoinspection using the executor
func (o *HistoryQamosquitoinspection) Reload(ctx context.Context, exec bob.Executor) error {
o2, err := HistoryQamosquitoinspections.Query(
sm.Where(HistoryQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(o.Objectid))),
sm.Where(HistoryQamosquitoinspections.Columns.Version.EQ(psql.Arg(o.Version))),
).One(ctx, exec)
if err != nil {
return err
}
o2.R = o.R
*o = *o2
return nil
}
// AfterQueryHook is called after HistoryQamosquitoinspectionSlice is retrieved from the database
func (o HistoryQamosquitoinspectionSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
var err error
switch queryType {
case bob.QueryTypeSelect:
ctx, err = HistoryQamosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, o)
case bob.QueryTypeInsert:
ctx, err = HistoryQamosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, o)
case bob.QueryTypeUpdate:
ctx, err = HistoryQamosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o)
case bob.QueryTypeDelete:
ctx, err = HistoryQamosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o)
}
return err
}
func (o HistoryQamosquitoinspectionSlice) pkIN() dialect.Expression {
if len(o) == 0 {
return psql.Raw("NULL")
}
return psql.Group(psql.Quote("history_qamosquitoinspection", "objectid"), psql.Quote("history_qamosquitoinspection", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.Writer, 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 HistoryQamosquitoinspectionSlice) copyMatchingRows(from ...*HistoryQamosquitoinspection) {
for i, old := range o {
for _, new := range from {
if new.Objectid != old.Objectid {
continue
}
if new.Version != old.Version {
continue
}
new.R = old.R
o[i] = new
break
}
}
}
// UpdateMod modifies an update query with "WHERE primary_key IN (o...)"
func (o HistoryQamosquitoinspectionSlice) 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 HistoryQamosquitoinspections.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 *HistoryQamosquitoinspection:
o.copyMatchingRows(retrieved)
case []*HistoryQamosquitoinspection:
o.copyMatchingRows(retrieved...)
case HistoryQamosquitoinspectionSlice:
o.copyMatchingRows(retrieved...)
default:
// If the retrieved value is not a HistoryQamosquitoinspection or a slice of HistoryQamosquitoinspection
// then run the AfterUpdateHooks on the slice
_, err = HistoryQamosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o)
}
return err
}))
q.AppendWhere(o.pkIN())
})
}
// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)"
func (o HistoryQamosquitoinspectionSlice) 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 HistoryQamosquitoinspections.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 *HistoryQamosquitoinspection:
o.copyMatchingRows(retrieved)
case []*HistoryQamosquitoinspection:
o.copyMatchingRows(retrieved...)
case HistoryQamosquitoinspectionSlice:
o.copyMatchingRows(retrieved...)
default:
// If the retrieved value is not a HistoryQamosquitoinspection or a slice of HistoryQamosquitoinspection
// then run the AfterDeleteHooks on the slice
_, err = HistoryQamosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o)
}
return err
}))
q.AppendWhere(o.pkIN())
})
}
func (o HistoryQamosquitoinspectionSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryQamosquitoinspectionSetter) error {
if len(o) == 0 {
return nil
}
_, err := HistoryQamosquitoinspections.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec)
return err
}
func (o HistoryQamosquitoinspectionSlice) DeleteAll(ctx context.Context, exec bob.Executor) error {
if len(o) == 0 {
return nil
}
_, err := HistoryQamosquitoinspections.Delete(o.DeleteMod()).Exec(ctx, exec)
return err
}
func (o HistoryQamosquitoinspectionSlice) ReloadAll(ctx context.Context, exec bob.Executor) error {
if len(o) == 0 {
return nil
}
o2, err := HistoryQamosquitoinspections.Query(sm.Where(o.pkIN())).All(ctx, exec)
if err != nil {
return err
}
o.copyMatchingRows(o2...)
return nil
}
// Organization starts a query for related objects on organization
func (o *HistoryQamosquitoinspection) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery {
return Organizations.Query(append(mods,
sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))),
)...)
}
func (os HistoryQamosquitoinspectionSlice) 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 attachHistoryQamosquitoinspectionOrganization0(ctx context.Context, exec bob.Executor, count int, historyQamosquitoinspection0 *HistoryQamosquitoinspection, organization1 *Organization) (*HistoryQamosquitoinspection, error) {
setter := &HistoryQamosquitoinspectionSetter{
OrganizationID: omit.From(organization1.ID),
}
err := historyQamosquitoinspection0.Update(ctx, exec, setter)
if err != nil {
return nil, fmt.Errorf("attachHistoryQamosquitoinspectionOrganization0: %w", err)
}
return historyQamosquitoinspection0, nil
}
func (historyQamosquitoinspection0 *HistoryQamosquitoinspection) 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 = attachHistoryQamosquitoinspectionOrganization0(ctx, exec, 1, historyQamosquitoinspection0, organization1)
if err != nil {
return err
}
historyQamosquitoinspection0.R.Organization = organization1
organization1.R.HistoryQamosquitoinspections = append(organization1.R.HistoryQamosquitoinspections, historyQamosquitoinspection0)
return nil
}
func (historyQamosquitoinspection0 *HistoryQamosquitoinspection) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error {
var err error
_, err = attachHistoryQamosquitoinspectionOrganization0(ctx, exec, 1, historyQamosquitoinspection0, organization1)
if err != nil {
return err
}
historyQamosquitoinspection0.R.Organization = organization1
organization1.R.HistoryQamosquitoinspections = append(organization1.R.HistoryQamosquitoinspections, historyQamosquitoinspection0)
return nil
}
type historyQamosquitoinspectionWhere[Q psql.Filterable] struct {
OrganizationID psql.WhereMod[Q, int32]
Acresbreeding psql.WhereNullMod[Q, float64]
Actiontaken psql.WhereNullMod[Q, string]
Adultactivity psql.WhereNullMod[Q, int16]
Aquaticorganisms psql.WhereNullMod[Q, string]
Avetemp psql.WhereNullMod[Q, float64]
Breedingpotential psql.WhereNullMod[Q, string]
Comments psql.WhereNullMod[Q, string]
Creationdate psql.WhereNullMod[Q, int64]
Creator psql.WhereNullMod[Q, string]
Enddatetime psql.WhereNullMod[Q, int64]
Editdate psql.WhereNullMod[Q, int64]
Editor psql.WhereNullMod[Q, string]
Fieldtech psql.WhereNullMod[Q, string]
Fish psql.WhereNullMod[Q, int16]
Globalid psql.WhereNullMod[Q, string]
Habvalue1 psql.WhereNullMod[Q, int16]
Habvalue1percent psql.WhereNullMod[Q, int16]
Habvalue2 psql.WhereNullMod[Q, int16]
Habvalue2percent psql.WhereNullMod[Q, int16]
Larvaeinsidetreatedarea psql.WhereNullMod[Q, int16]
Larvaeoutsidetreatedarea psql.WhereNullMod[Q, int16]
Larvaepresent psql.WhereNullMod[Q, int16]
Larvaereason psql.WhereNullMod[Q, string]
Linelocid psql.WhereNullMod[Q, string]
Locationname psql.WhereNullMod[Q, string]
LR psql.WhereNullMod[Q, int16]
Mosquitohabitat psql.WhereNullMod[Q, string]
Movingwater psql.WhereNullMod[Q, int16]
Negdips psql.WhereNullMod[Q, int16]
Nowaterever psql.WhereNullMod[Q, int16]
Objectid psql.WhereMod[Q, int32]
Pointlocid psql.WhereNullMod[Q, string]
Polygonlocid psql.WhereNullMod[Q, string]
Posdips psql.WhereNullMod[Q, int16]
Potential psql.WhereNullMod[Q, int16]
Raingauge psql.WhereNullMod[Q, float64]
Recordstatus psql.WhereNullMod[Q, int16]
Reviewed psql.WhereNullMod[Q, int16]
Reviewedby psql.WhereNullMod[Q, string]
Revieweddate psql.WhereNullMod[Q, int64]
Sitetype psql.WhereNullMod[Q, string]
Soilconditions psql.WhereNullMod[Q, string]
Sourcereduction psql.WhereNullMod[Q, string]
Startdatetime psql.WhereNullMod[Q, int64]
Totalacres psql.WhereNullMod[Q, float64]
Vegetation psql.WhereNullMod[Q, string]
Waterconditions psql.WhereNullMod[Q, string]
Waterduration psql.WhereNullMod[Q, string]
Watermovement1 psql.WhereNullMod[Q, string]
Watermovement1percent psql.WhereNullMod[Q, int16]
Watermovement2 psql.WhereNullMod[Q, string]
Watermovement2percent psql.WhereNullMod[Q, int16]
Waterpresent psql.WhereNullMod[Q, int16]
Watersource psql.WhereNullMod[Q, string]
Winddir psql.WhereNullMod[Q, string]
Windspeed psql.WhereNullMod[Q, float64]
Zone psql.WhereNullMod[Q, string]
Zone2 psql.WhereNullMod[Q, string]
Created psql.WhereNullMod[Q, time.Time]
CreatedDate psql.WhereNullMod[Q, int64]
CreatedUser psql.WhereNullMod[Q, string]
GeometryX psql.WhereNullMod[Q, float64]
GeometryY psql.WhereNullMod[Q, float64]
LastEditedDate psql.WhereNullMod[Q, int64]
LastEditedUser psql.WhereNullMod[Q, string]
Version psql.WhereMod[Q, int32]
}
func (historyQamosquitoinspectionWhere[Q]) AliasedAs(alias string) historyQamosquitoinspectionWhere[Q] {
return buildHistoryQamosquitoinspectionWhere[Q](buildHistoryQamosquitoinspectionColumns(alias))
}
func buildHistoryQamosquitoinspectionWhere[Q psql.Filterable](cols historyQamosquitoinspectionColumns) historyQamosquitoinspectionWhere[Q] {
return historyQamosquitoinspectionWhere[Q]{
OrganizationID: psql.Where[Q, int32](cols.OrganizationID),
Acresbreeding: psql.WhereNull[Q, float64](cols.Acresbreeding),
Actiontaken: psql.WhereNull[Q, string](cols.Actiontaken),
Adultactivity: psql.WhereNull[Q, int16](cols.Adultactivity),
Aquaticorganisms: psql.WhereNull[Q, string](cols.Aquaticorganisms),
Avetemp: psql.WhereNull[Q, float64](cols.Avetemp),
Breedingpotential: psql.WhereNull[Q, string](cols.Breedingpotential),
Comments: psql.WhereNull[Q, string](cols.Comments),
Creationdate: psql.WhereNull[Q, int64](cols.Creationdate),
Creator: psql.WhereNull[Q, string](cols.Creator),
Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime),
Editdate: psql.WhereNull[Q, int64](cols.Editdate),
Editor: psql.WhereNull[Q, string](cols.Editor),
Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech),
Fish: psql.WhereNull[Q, int16](cols.Fish),
Globalid: psql.WhereNull[Q, string](cols.Globalid),
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),
Larvaeinsidetreatedarea: psql.WhereNull[Q, int16](cols.Larvaeinsidetreatedarea),
Larvaeoutsidetreatedarea: psql.WhereNull[Q, int16](cols.Larvaeoutsidetreatedarea),
Larvaepresent: psql.WhereNull[Q, int16](cols.Larvaepresent),
Larvaereason: psql.WhereNull[Q, string](cols.Larvaereason),
Linelocid: psql.WhereNull[Q, string](cols.Linelocid),
Locationname: psql.WhereNull[Q, string](cols.Locationname),
LR: psql.WhereNull[Q, int16](cols.LR),
Mosquitohabitat: psql.WhereNull[Q, string](cols.Mosquitohabitat),
Movingwater: psql.WhereNull[Q, int16](cols.Movingwater),
Negdips: psql.WhereNull[Q, int16](cols.Negdips),
Nowaterever: psql.WhereNull[Q, int16](cols.Nowaterever),
Objectid: psql.Where[Q, int32](cols.Objectid),
Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid),
Polygonlocid: psql.WhereNull[Q, string](cols.Polygonlocid),
Posdips: psql.WhereNull[Q, int16](cols.Posdips),
Potential: psql.WhereNull[Q, int16](cols.Potential),
Raingauge: psql.WhereNull[Q, float64](cols.Raingauge),
Recordstatus: psql.WhereNull[Q, int16](cols.Recordstatus),
Reviewed: psql.WhereNull[Q, int16](cols.Reviewed),
Reviewedby: psql.WhereNull[Q, string](cols.Reviewedby),
Revieweddate: psql.WhereNull[Q, int64](cols.Revieweddate),
Sitetype: psql.WhereNull[Q, string](cols.Sitetype),
Soilconditions: psql.WhereNull[Q, string](cols.Soilconditions),
Sourcereduction: psql.WhereNull[Q, string](cols.Sourcereduction),
Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime),
Totalacres: psql.WhereNull[Q, float64](cols.Totalacres),
Vegetation: psql.WhereNull[Q, string](cols.Vegetation),
Waterconditions: psql.WhereNull[Q, string](cols.Waterconditions),
Waterduration: psql.WhereNull[Q, string](cols.Waterduration),
Watermovement1: psql.WhereNull[Q, string](cols.Watermovement1),
Watermovement1percent: psql.WhereNull[Q, int16](cols.Watermovement1percent),
Watermovement2: psql.WhereNull[Q, string](cols.Watermovement2),
Watermovement2percent: psql.WhereNull[Q, int16](cols.Watermovement2percent),
Waterpresent: psql.WhereNull[Q, int16](cols.Waterpresent),
Watersource: psql.WhereNull[Q, string](cols.Watersource),
Winddir: psql.WhereNull[Q, string](cols.Winddir),
Windspeed: psql.WhereNull[Q, float64](cols.Windspeed),
Zone: psql.WhereNull[Q, string](cols.Zone),
Zone2: psql.WhereNull[Q, string](cols.Zone2),
Created: psql.WhereNull[Q, time.Time](cols.Created),
CreatedDate: psql.WhereNull[Q, int64](cols.CreatedDate),
CreatedUser: psql.WhereNull[Q, string](cols.CreatedUser),
GeometryX: psql.WhereNull[Q, float64](cols.GeometryX),
GeometryY: psql.WhereNull[Q, float64](cols.GeometryY),
LastEditedDate: psql.WhereNull[Q, int64](cols.LastEditedDate),
LastEditedUser: psql.WhereNull[Q, string](cols.LastEditedUser),
Version: psql.Where[Q, int32](cols.Version),
}
}
func (o *HistoryQamosquitoinspection) Preload(name string, retrieved any) error {
if o == nil {
return nil
}
switch name {
case "Organization":
rel, ok := retrieved.(*Organization)
if !ok {
return fmt.Errorf("historyQamosquitoinspection cannot load %T as %q", retrieved, name)
}
o.R.Organization = rel
if rel != nil {
rel.R.HistoryQamosquitoinspections = HistoryQamosquitoinspectionSlice{o}
}
return nil
default:
return fmt.Errorf("historyQamosquitoinspection has no relationship %q", name)
}
}
type historyQamosquitoinspectionPreloader struct {
Organization func(...psql.PreloadOption) psql.Preloader
}
func buildHistoryQamosquitoinspectionPreloader() historyQamosquitoinspectionPreloader {
return historyQamosquitoinspectionPreloader{
Organization: func(opts ...psql.PreloadOption) psql.Preloader {
return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{
Name: "Organization",
Sides: []psql.PreloadSide{
{
From: HistoryQamosquitoinspections,
To: Organizations,
FromColumns: []string{"organization_id"},
ToColumns: []string{"id"},
},
},
}, Organizations.Columns.Names(), opts...)
},
}
}
type historyQamosquitoinspectionThenLoader[Q orm.Loadable] struct {
Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
}
func buildHistoryQamosquitoinspectionThenLoader[Q orm.Loadable]() historyQamosquitoinspectionThenLoader[Q] {
type OrganizationLoadInterface interface {
LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
}
return historyQamosquitoinspectionThenLoader[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 historyQamosquitoinspection's Organization into the .R struct
func (o *HistoryQamosquitoinspection) 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.HistoryQamosquitoinspections = HistoryQamosquitoinspectionSlice{o}
o.R.Organization = related
return nil
}
// LoadOrganization loads the historyQamosquitoinspection's Organization into the .R struct
func (os HistoryQamosquitoinspectionSlice) 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.HistoryQamosquitoinspections = append(rel.R.HistoryQamosquitoinspections, o)
o.R.Organization = rel
break
}
}
return nil
}
type historyQamosquitoinspectionJoins[Q dialect.Joinable] struct {
typ string
Organization modAs[Q, organizationColumns]
}
func (j historyQamosquitoinspectionJoins[Q]) aliasedAs(alias string) historyQamosquitoinspectionJoins[Q] {
return buildHistoryQamosquitoinspectionJoins[Q](buildHistoryQamosquitoinspectionColumns(alias), j.typ)
}
func buildHistoryQamosquitoinspectionJoins[Q dialect.Joinable](cols historyQamosquitoinspectionColumns, typ string) historyQamosquitoinspectionJoins[Q] {
return historyQamosquitoinspectionJoins[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
},
},
}
}