nidus-sync/db/models/history_mosquitoinspection.bob.go

2115 lines
68 KiB
Go

// Code generated by BobGen psql v0.0.3-0.20251202003046-49148fc66a73+dirty. DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
package models
import (
"context"
"fmt"
"io"
"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"
)
// HistoryMosquitoinspection is an object representing the database table.
type HistoryMosquitoinspection struct {
OrganizationID int32 `db:"organization_id" `
Actiontaken null.Val[string] `db:"actiontaken" `
Activity null.Val[string] `db:"activity" `
Adultact null.Val[string] `db:"adultact" `
Avetemp null.Val[float64] `db:"avetemp" `
Avglarvae null.Val[float64] `db:"avglarvae" `
Avgpupae null.Val[float64] `db:"avgpupae" `
Breeding null.Val[string] `db:"breeding" `
Cbcount null.Val[int16] `db:"cbcount" `
Comments null.Val[string] `db:"comments" `
Containercount null.Val[int16] `db:"containercount" `
Creationdate null.Val[int64] `db:"creationdate" `
Creator null.Val[string] `db:"creator" `
Domstage null.Val[string] `db:"domstage" `
Eggs null.Val[int16] `db:"eggs" `
Enddatetime null.Val[int64] `db:"enddatetime" `
Editdate null.Val[int64] `db:"editdate" `
Editor null.Val[string] `db:"editor" `
Fieldspecies null.Val[string] `db:"fieldspecies" `
Fieldtech null.Val[string] `db:"fieldtech" `
Globalid null.Val[string] `db:"globalid" `
Jurisdiction null.Val[string] `db:"jurisdiction" `
Larvaepresent null.Val[int16] `db:"larvaepresent" `
Linelocid null.Val[string] `db:"linelocid" `
Locationname null.Val[string] `db:"locationname" `
Lstages null.Val[string] `db:"lstages" `
Numdips null.Val[int16] `db:"numdips" `
Objectid int32 `db:"objectid,pk" `
Personalcontact null.Val[int16] `db:"personalcontact" `
Pointlocid null.Val[string] `db:"pointlocid" `
Polygonlocid null.Val[string] `db:"polygonlocid" `
Posdips null.Val[int16] `db:"posdips" `
Positivecontainercount null.Val[int16] `db:"positivecontainercount" `
Pupaepresent null.Val[int16] `db:"pupaepresent" `
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" `
Sdid null.Val[string] `db:"sdid" `
Sitecond null.Val[string] `db:"sitecond" `
Srid null.Val[string] `db:"srid" `
Startdatetime null.Val[int64] `db:"startdatetime" `
Tirecount null.Val[int16] `db:"tirecount" `
Totlarvae null.Val[int16] `db:"totlarvae" `
Totpupae null.Val[int16] `db:"totpupae" `
Visualmonitoring null.Val[int16] `db:"visualmonitoring" `
Vmcomments null.Val[string] `db:"vmcomments" `
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" `
Adminaction null.Val[string] `db:"adminaction" `
Ptaid null.Val[string] `db:"ptaid" `
Version int32 `db:"version,pk" `
R historyMosquitoinspectionR `db:"-" `
}
// HistoryMosquitoinspectionSlice is an alias for a slice of pointers to HistoryMosquitoinspection.
// This should almost always be used instead of []*HistoryMosquitoinspection.
type HistoryMosquitoinspectionSlice []*HistoryMosquitoinspection
// HistoryMosquitoinspections contains methods to work with the history_mosquitoinspection table
var HistoryMosquitoinspections = psql.NewTablex[*HistoryMosquitoinspection, HistoryMosquitoinspectionSlice, *HistoryMosquitoinspectionSetter]("", "history_mosquitoinspection", buildHistoryMosquitoinspectionColumns("history_mosquitoinspection"))
// HistoryMosquitoinspectionsQuery is a query on the history_mosquitoinspection table
type HistoryMosquitoinspectionsQuery = *psql.ViewQuery[*HistoryMosquitoinspection, HistoryMosquitoinspectionSlice]
// historyMosquitoinspectionR is where relationships are stored.
type historyMosquitoinspectionR struct {
Organization *Organization // history_mosquitoinspection.history_mosquitoinspection_organization_id_fkey
}
func buildHistoryMosquitoinspectionColumns(alias string) historyMosquitoinspectionColumns {
return historyMosquitoinspectionColumns{
ColumnsExpr: expr.NewColumnsExpr(
"organization_id", "actiontaken", "activity", "adultact", "avetemp", "avglarvae", "avgpupae", "breeding", "cbcount", "comments", "containercount", "creationdate", "creator", "domstage", "eggs", "enddatetime", "editdate", "editor", "fieldspecies", "fieldtech", "globalid", "jurisdiction", "larvaepresent", "linelocid", "locationname", "lstages", "numdips", "objectid", "personalcontact", "pointlocid", "polygonlocid", "posdips", "positivecontainercount", "pupaepresent", "raingauge", "recordstatus", "reviewed", "reviewedby", "revieweddate", "sdid", "sitecond", "srid", "startdatetime", "tirecount", "totlarvae", "totpupae", "visualmonitoring", "vmcomments", "winddir", "windspeed", "zone", "zone2", "created", "created_date", "created_user", "geometry_x", "geometry_y", "last_edited_date", "last_edited_user", "adminaction", "ptaid", "version",
).WithParent("history_mosquitoinspection"),
tableAlias: alias,
OrganizationID: psql.Quote(alias, "organization_id"),
Actiontaken: psql.Quote(alias, "actiontaken"),
Activity: psql.Quote(alias, "activity"),
Adultact: psql.Quote(alias, "adultact"),
Avetemp: psql.Quote(alias, "avetemp"),
Avglarvae: psql.Quote(alias, "avglarvae"),
Avgpupae: psql.Quote(alias, "avgpupae"),
Breeding: psql.Quote(alias, "breeding"),
Cbcount: psql.Quote(alias, "cbcount"),
Comments: psql.Quote(alias, "comments"),
Containercount: psql.Quote(alias, "containercount"),
Creationdate: psql.Quote(alias, "creationdate"),
Creator: psql.Quote(alias, "creator"),
Domstage: psql.Quote(alias, "domstage"),
Eggs: psql.Quote(alias, "eggs"),
Enddatetime: psql.Quote(alias, "enddatetime"),
Editdate: psql.Quote(alias, "editdate"),
Editor: psql.Quote(alias, "editor"),
Fieldspecies: psql.Quote(alias, "fieldspecies"),
Fieldtech: psql.Quote(alias, "fieldtech"),
Globalid: psql.Quote(alias, "globalid"),
Jurisdiction: psql.Quote(alias, "jurisdiction"),
Larvaepresent: psql.Quote(alias, "larvaepresent"),
Linelocid: psql.Quote(alias, "linelocid"),
Locationname: psql.Quote(alias, "locationname"),
Lstages: psql.Quote(alias, "lstages"),
Numdips: psql.Quote(alias, "numdips"),
Objectid: psql.Quote(alias, "objectid"),
Personalcontact: psql.Quote(alias, "personalcontact"),
Pointlocid: psql.Quote(alias, "pointlocid"),
Polygonlocid: psql.Quote(alias, "polygonlocid"),
Posdips: psql.Quote(alias, "posdips"),
Positivecontainercount: psql.Quote(alias, "positivecontainercount"),
Pupaepresent: psql.Quote(alias, "pupaepresent"),
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"),
Sdid: psql.Quote(alias, "sdid"),
Sitecond: psql.Quote(alias, "sitecond"),
Srid: psql.Quote(alias, "srid"),
Startdatetime: psql.Quote(alias, "startdatetime"),
Tirecount: psql.Quote(alias, "tirecount"),
Totlarvae: psql.Quote(alias, "totlarvae"),
Totpupae: psql.Quote(alias, "totpupae"),
Visualmonitoring: psql.Quote(alias, "visualmonitoring"),
Vmcomments: psql.Quote(alias, "vmcomments"),
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"),
Adminaction: psql.Quote(alias, "adminaction"),
Ptaid: psql.Quote(alias, "ptaid"),
Version: psql.Quote(alias, "version"),
}
}
type historyMosquitoinspectionColumns struct {
expr.ColumnsExpr
tableAlias string
OrganizationID psql.Expression
Actiontaken psql.Expression
Activity psql.Expression
Adultact psql.Expression
Avetemp psql.Expression
Avglarvae psql.Expression
Avgpupae psql.Expression
Breeding psql.Expression
Cbcount psql.Expression
Comments psql.Expression
Containercount psql.Expression
Creationdate psql.Expression
Creator psql.Expression
Domstage psql.Expression
Eggs psql.Expression
Enddatetime psql.Expression
Editdate psql.Expression
Editor psql.Expression
Fieldspecies psql.Expression
Fieldtech psql.Expression
Globalid psql.Expression
Jurisdiction psql.Expression
Larvaepresent psql.Expression
Linelocid psql.Expression
Locationname psql.Expression
Lstages psql.Expression
Numdips psql.Expression
Objectid psql.Expression
Personalcontact psql.Expression
Pointlocid psql.Expression
Polygonlocid psql.Expression
Posdips psql.Expression
Positivecontainercount psql.Expression
Pupaepresent psql.Expression
Raingauge psql.Expression
Recordstatus psql.Expression
Reviewed psql.Expression
Reviewedby psql.Expression
Revieweddate psql.Expression
Sdid psql.Expression
Sitecond psql.Expression
Srid psql.Expression
Startdatetime psql.Expression
Tirecount psql.Expression
Totlarvae psql.Expression
Totpupae psql.Expression
Visualmonitoring psql.Expression
Vmcomments 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
Adminaction psql.Expression
Ptaid psql.Expression
Version psql.Expression
}
func (c historyMosquitoinspectionColumns) Alias() string {
return c.tableAlias
}
func (historyMosquitoinspectionColumns) AliasedAs(alias string) historyMosquitoinspectionColumns {
return buildHistoryMosquitoinspectionColumns(alias)
}
// HistoryMosquitoinspectionSetter is used for insert/upsert/update operations
// All values are optional, and do not have to be set
// Generated columns are not included
type HistoryMosquitoinspectionSetter struct {
OrganizationID omit.Val[int32] `db:"organization_id" `
Actiontaken omitnull.Val[string] `db:"actiontaken" `
Activity omitnull.Val[string] `db:"activity" `
Adultact omitnull.Val[string] `db:"adultact" `
Avetemp omitnull.Val[float64] `db:"avetemp" `
Avglarvae omitnull.Val[float64] `db:"avglarvae" `
Avgpupae omitnull.Val[float64] `db:"avgpupae" `
Breeding omitnull.Val[string] `db:"breeding" `
Cbcount omitnull.Val[int16] `db:"cbcount" `
Comments omitnull.Val[string] `db:"comments" `
Containercount omitnull.Val[int16] `db:"containercount" `
Creationdate omitnull.Val[int64] `db:"creationdate" `
Creator omitnull.Val[string] `db:"creator" `
Domstage omitnull.Val[string] `db:"domstage" `
Eggs omitnull.Val[int16] `db:"eggs" `
Enddatetime omitnull.Val[int64] `db:"enddatetime" `
Editdate omitnull.Val[int64] `db:"editdate" `
Editor omitnull.Val[string] `db:"editor" `
Fieldspecies omitnull.Val[string] `db:"fieldspecies" `
Fieldtech omitnull.Val[string] `db:"fieldtech" `
Globalid omitnull.Val[string] `db:"globalid" `
Jurisdiction omitnull.Val[string] `db:"jurisdiction" `
Larvaepresent omitnull.Val[int16] `db:"larvaepresent" `
Linelocid omitnull.Val[string] `db:"linelocid" `
Locationname omitnull.Val[string] `db:"locationname" `
Lstages omitnull.Val[string] `db:"lstages" `
Numdips omitnull.Val[int16] `db:"numdips" `
Objectid omit.Val[int32] `db:"objectid,pk" `
Personalcontact omitnull.Val[int16] `db:"personalcontact" `
Pointlocid omitnull.Val[string] `db:"pointlocid" `
Polygonlocid omitnull.Val[string] `db:"polygonlocid" `
Posdips omitnull.Val[int16] `db:"posdips" `
Positivecontainercount omitnull.Val[int16] `db:"positivecontainercount" `
Pupaepresent omitnull.Val[int16] `db:"pupaepresent" `
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" `
Sdid omitnull.Val[string] `db:"sdid" `
Sitecond omitnull.Val[string] `db:"sitecond" `
Srid omitnull.Val[string] `db:"srid" `
Startdatetime omitnull.Val[int64] `db:"startdatetime" `
Tirecount omitnull.Val[int16] `db:"tirecount" `
Totlarvae omitnull.Val[int16] `db:"totlarvae" `
Totpupae omitnull.Val[int16] `db:"totpupae" `
Visualmonitoring omitnull.Val[int16] `db:"visualmonitoring" `
Vmcomments omitnull.Val[string] `db:"vmcomments" `
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" `
Adminaction omitnull.Val[string] `db:"adminaction" `
Ptaid omitnull.Val[string] `db:"ptaid" `
Version omit.Val[int32] `db:"version,pk" `
}
func (s HistoryMosquitoinspectionSetter) SetColumns() []string {
vals := make([]string, 0, 62)
if s.OrganizationID.IsValue() {
vals = append(vals, "organization_id")
}
if !s.Actiontaken.IsUnset() {
vals = append(vals, "actiontaken")
}
if !s.Activity.IsUnset() {
vals = append(vals, "activity")
}
if !s.Adultact.IsUnset() {
vals = append(vals, "adultact")
}
if !s.Avetemp.IsUnset() {
vals = append(vals, "avetemp")
}
if !s.Avglarvae.IsUnset() {
vals = append(vals, "avglarvae")
}
if !s.Avgpupae.IsUnset() {
vals = append(vals, "avgpupae")
}
if !s.Breeding.IsUnset() {
vals = append(vals, "breeding")
}
if !s.Cbcount.IsUnset() {
vals = append(vals, "cbcount")
}
if !s.Comments.IsUnset() {
vals = append(vals, "comments")
}
if !s.Containercount.IsUnset() {
vals = append(vals, "containercount")
}
if !s.Creationdate.IsUnset() {
vals = append(vals, "creationdate")
}
if !s.Creator.IsUnset() {
vals = append(vals, "creator")
}
if !s.Domstage.IsUnset() {
vals = append(vals, "domstage")
}
if !s.Eggs.IsUnset() {
vals = append(vals, "eggs")
}
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.Fieldspecies.IsUnset() {
vals = append(vals, "fieldspecies")
}
if !s.Fieldtech.IsUnset() {
vals = append(vals, "fieldtech")
}
if !s.Globalid.IsUnset() {
vals = append(vals, "globalid")
}
if !s.Jurisdiction.IsUnset() {
vals = append(vals, "jurisdiction")
}
if !s.Larvaepresent.IsUnset() {
vals = append(vals, "larvaepresent")
}
if !s.Linelocid.IsUnset() {
vals = append(vals, "linelocid")
}
if !s.Locationname.IsUnset() {
vals = append(vals, "locationname")
}
if !s.Lstages.IsUnset() {
vals = append(vals, "lstages")
}
if !s.Numdips.IsUnset() {
vals = append(vals, "numdips")
}
if s.Objectid.IsValue() {
vals = append(vals, "objectid")
}
if !s.Personalcontact.IsUnset() {
vals = append(vals, "personalcontact")
}
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.Positivecontainercount.IsUnset() {
vals = append(vals, "positivecontainercount")
}
if !s.Pupaepresent.IsUnset() {
vals = append(vals, "pupaepresent")
}
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.Sdid.IsUnset() {
vals = append(vals, "sdid")
}
if !s.Sitecond.IsUnset() {
vals = append(vals, "sitecond")
}
if !s.Srid.IsUnset() {
vals = append(vals, "srid")
}
if !s.Startdatetime.IsUnset() {
vals = append(vals, "startdatetime")
}
if !s.Tirecount.IsUnset() {
vals = append(vals, "tirecount")
}
if !s.Totlarvae.IsUnset() {
vals = append(vals, "totlarvae")
}
if !s.Totpupae.IsUnset() {
vals = append(vals, "totpupae")
}
if !s.Visualmonitoring.IsUnset() {
vals = append(vals, "visualmonitoring")
}
if !s.Vmcomments.IsUnset() {
vals = append(vals, "vmcomments")
}
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.Adminaction.IsUnset() {
vals = append(vals, "adminaction")
}
if !s.Ptaid.IsUnset() {
vals = append(vals, "ptaid")
}
if s.Version.IsValue() {
vals = append(vals, "version")
}
return vals
}
func (s HistoryMosquitoinspectionSetter) Overwrite(t *HistoryMosquitoinspection) {
if s.OrganizationID.IsValue() {
t.OrganizationID = s.OrganizationID.MustGet()
}
if !s.Actiontaken.IsUnset() {
t.Actiontaken = s.Actiontaken.MustGetNull()
}
if !s.Activity.IsUnset() {
t.Activity = s.Activity.MustGetNull()
}
if !s.Adultact.IsUnset() {
t.Adultact = s.Adultact.MustGetNull()
}
if !s.Avetemp.IsUnset() {
t.Avetemp = s.Avetemp.MustGetNull()
}
if !s.Avglarvae.IsUnset() {
t.Avglarvae = s.Avglarvae.MustGetNull()
}
if !s.Avgpupae.IsUnset() {
t.Avgpupae = s.Avgpupae.MustGetNull()
}
if !s.Breeding.IsUnset() {
t.Breeding = s.Breeding.MustGetNull()
}
if !s.Cbcount.IsUnset() {
t.Cbcount = s.Cbcount.MustGetNull()
}
if !s.Comments.IsUnset() {
t.Comments = s.Comments.MustGetNull()
}
if !s.Containercount.IsUnset() {
t.Containercount = s.Containercount.MustGetNull()
}
if !s.Creationdate.IsUnset() {
t.Creationdate = s.Creationdate.MustGetNull()
}
if !s.Creator.IsUnset() {
t.Creator = s.Creator.MustGetNull()
}
if !s.Domstage.IsUnset() {
t.Domstage = s.Domstage.MustGetNull()
}
if !s.Eggs.IsUnset() {
t.Eggs = s.Eggs.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.Fieldspecies.IsUnset() {
t.Fieldspecies = s.Fieldspecies.MustGetNull()
}
if !s.Fieldtech.IsUnset() {
t.Fieldtech = s.Fieldtech.MustGetNull()
}
if !s.Globalid.IsUnset() {
t.Globalid = s.Globalid.MustGetNull()
}
if !s.Jurisdiction.IsUnset() {
t.Jurisdiction = s.Jurisdiction.MustGetNull()
}
if !s.Larvaepresent.IsUnset() {
t.Larvaepresent = s.Larvaepresent.MustGetNull()
}
if !s.Linelocid.IsUnset() {
t.Linelocid = s.Linelocid.MustGetNull()
}
if !s.Locationname.IsUnset() {
t.Locationname = s.Locationname.MustGetNull()
}
if !s.Lstages.IsUnset() {
t.Lstages = s.Lstages.MustGetNull()
}
if !s.Numdips.IsUnset() {
t.Numdips = s.Numdips.MustGetNull()
}
if s.Objectid.IsValue() {
t.Objectid = s.Objectid.MustGet()
}
if !s.Personalcontact.IsUnset() {
t.Personalcontact = s.Personalcontact.MustGetNull()
}
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.Positivecontainercount.IsUnset() {
t.Positivecontainercount = s.Positivecontainercount.MustGetNull()
}
if !s.Pupaepresent.IsUnset() {
t.Pupaepresent = s.Pupaepresent.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.Sdid.IsUnset() {
t.Sdid = s.Sdid.MustGetNull()
}
if !s.Sitecond.IsUnset() {
t.Sitecond = s.Sitecond.MustGetNull()
}
if !s.Srid.IsUnset() {
t.Srid = s.Srid.MustGetNull()
}
if !s.Startdatetime.IsUnset() {
t.Startdatetime = s.Startdatetime.MustGetNull()
}
if !s.Tirecount.IsUnset() {
t.Tirecount = s.Tirecount.MustGetNull()
}
if !s.Totlarvae.IsUnset() {
t.Totlarvae = s.Totlarvae.MustGetNull()
}
if !s.Totpupae.IsUnset() {
t.Totpupae = s.Totpupae.MustGetNull()
}
if !s.Visualmonitoring.IsUnset() {
t.Visualmonitoring = s.Visualmonitoring.MustGetNull()
}
if !s.Vmcomments.IsUnset() {
t.Vmcomments = s.Vmcomments.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.Adminaction.IsUnset() {
t.Adminaction = s.Adminaction.MustGetNull()
}
if !s.Ptaid.IsUnset() {
t.Ptaid = s.Ptaid.MustGetNull()
}
if s.Version.IsValue() {
t.Version = s.Version.MustGet()
}
}
func (s *HistoryMosquitoinspectionSetter) Apply(q *dialect.InsertQuery) {
q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) {
return HistoryMosquitoinspections.BeforeInsertHooks.RunHooks(ctx, exec, s)
})
q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
vals := make([]bob.Expression, 62)
if s.OrganizationID.IsValue() {
vals[0] = psql.Arg(s.OrganizationID.MustGet())
} else {
vals[0] = psql.Raw("DEFAULT")
}
if !s.Actiontaken.IsUnset() {
vals[1] = psql.Arg(s.Actiontaken.MustGetNull())
} else {
vals[1] = psql.Raw("DEFAULT")
}
if !s.Activity.IsUnset() {
vals[2] = psql.Arg(s.Activity.MustGetNull())
} else {
vals[2] = psql.Raw("DEFAULT")
}
if !s.Adultact.IsUnset() {
vals[3] = psql.Arg(s.Adultact.MustGetNull())
} else {
vals[3] = psql.Raw("DEFAULT")
}
if !s.Avetemp.IsUnset() {
vals[4] = psql.Arg(s.Avetemp.MustGetNull())
} else {
vals[4] = psql.Raw("DEFAULT")
}
if !s.Avglarvae.IsUnset() {
vals[5] = psql.Arg(s.Avglarvae.MustGetNull())
} else {
vals[5] = psql.Raw("DEFAULT")
}
if !s.Avgpupae.IsUnset() {
vals[6] = psql.Arg(s.Avgpupae.MustGetNull())
} else {
vals[6] = psql.Raw("DEFAULT")
}
if !s.Breeding.IsUnset() {
vals[7] = psql.Arg(s.Breeding.MustGetNull())
} else {
vals[7] = psql.Raw("DEFAULT")
}
if !s.Cbcount.IsUnset() {
vals[8] = psql.Arg(s.Cbcount.MustGetNull())
} else {
vals[8] = psql.Raw("DEFAULT")
}
if !s.Comments.IsUnset() {
vals[9] = psql.Arg(s.Comments.MustGetNull())
} else {
vals[9] = psql.Raw("DEFAULT")
}
if !s.Containercount.IsUnset() {
vals[10] = psql.Arg(s.Containercount.MustGetNull())
} else {
vals[10] = psql.Raw("DEFAULT")
}
if !s.Creationdate.IsUnset() {
vals[11] = psql.Arg(s.Creationdate.MustGetNull())
} else {
vals[11] = psql.Raw("DEFAULT")
}
if !s.Creator.IsUnset() {
vals[12] = psql.Arg(s.Creator.MustGetNull())
} else {
vals[12] = psql.Raw("DEFAULT")
}
if !s.Domstage.IsUnset() {
vals[13] = psql.Arg(s.Domstage.MustGetNull())
} else {
vals[13] = psql.Raw("DEFAULT")
}
if !s.Eggs.IsUnset() {
vals[14] = psql.Arg(s.Eggs.MustGetNull())
} else {
vals[14] = psql.Raw("DEFAULT")
}
if !s.Enddatetime.IsUnset() {
vals[15] = psql.Arg(s.Enddatetime.MustGetNull())
} else {
vals[15] = psql.Raw("DEFAULT")
}
if !s.Editdate.IsUnset() {
vals[16] = psql.Arg(s.Editdate.MustGetNull())
} else {
vals[16] = psql.Raw("DEFAULT")
}
if !s.Editor.IsUnset() {
vals[17] = psql.Arg(s.Editor.MustGetNull())
} else {
vals[17] = psql.Raw("DEFAULT")
}
if !s.Fieldspecies.IsUnset() {
vals[18] = psql.Arg(s.Fieldspecies.MustGetNull())
} else {
vals[18] = psql.Raw("DEFAULT")
}
if !s.Fieldtech.IsUnset() {
vals[19] = psql.Arg(s.Fieldtech.MustGetNull())
} else {
vals[19] = psql.Raw("DEFAULT")
}
if !s.Globalid.IsUnset() {
vals[20] = psql.Arg(s.Globalid.MustGetNull())
} else {
vals[20] = psql.Raw("DEFAULT")
}
if !s.Jurisdiction.IsUnset() {
vals[21] = psql.Arg(s.Jurisdiction.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.Linelocid.IsUnset() {
vals[23] = psql.Arg(s.Linelocid.MustGetNull())
} else {
vals[23] = psql.Raw("DEFAULT")
}
if !s.Locationname.IsUnset() {
vals[24] = psql.Arg(s.Locationname.MustGetNull())
} else {
vals[24] = psql.Raw("DEFAULT")
}
if !s.Lstages.IsUnset() {
vals[25] = psql.Arg(s.Lstages.MustGetNull())
} else {
vals[25] = psql.Raw("DEFAULT")
}
if !s.Numdips.IsUnset() {
vals[26] = psql.Arg(s.Numdips.MustGetNull())
} else {
vals[26] = psql.Raw("DEFAULT")
}
if s.Objectid.IsValue() {
vals[27] = psql.Arg(s.Objectid.MustGet())
} else {
vals[27] = psql.Raw("DEFAULT")
}
if !s.Personalcontact.IsUnset() {
vals[28] = psql.Arg(s.Personalcontact.MustGetNull())
} else {
vals[28] = psql.Raw("DEFAULT")
}
if !s.Pointlocid.IsUnset() {
vals[29] = psql.Arg(s.Pointlocid.MustGetNull())
} else {
vals[29] = psql.Raw("DEFAULT")
}
if !s.Polygonlocid.IsUnset() {
vals[30] = psql.Arg(s.Polygonlocid.MustGetNull())
} else {
vals[30] = psql.Raw("DEFAULT")
}
if !s.Posdips.IsUnset() {
vals[31] = psql.Arg(s.Posdips.MustGetNull())
} else {
vals[31] = psql.Raw("DEFAULT")
}
if !s.Positivecontainercount.IsUnset() {
vals[32] = psql.Arg(s.Positivecontainercount.MustGetNull())
} else {
vals[32] = psql.Raw("DEFAULT")
}
if !s.Pupaepresent.IsUnset() {
vals[33] = psql.Arg(s.Pupaepresent.MustGetNull())
} else {
vals[33] = psql.Raw("DEFAULT")
}
if !s.Raingauge.IsUnset() {
vals[34] = psql.Arg(s.Raingauge.MustGetNull())
} else {
vals[34] = psql.Raw("DEFAULT")
}
if !s.Recordstatus.IsUnset() {
vals[35] = psql.Arg(s.Recordstatus.MustGetNull())
} else {
vals[35] = psql.Raw("DEFAULT")
}
if !s.Reviewed.IsUnset() {
vals[36] = psql.Arg(s.Reviewed.MustGetNull())
} else {
vals[36] = psql.Raw("DEFAULT")
}
if !s.Reviewedby.IsUnset() {
vals[37] = psql.Arg(s.Reviewedby.MustGetNull())
} else {
vals[37] = psql.Raw("DEFAULT")
}
if !s.Revieweddate.IsUnset() {
vals[38] = psql.Arg(s.Revieweddate.MustGetNull())
} else {
vals[38] = psql.Raw("DEFAULT")
}
if !s.Sdid.IsUnset() {
vals[39] = psql.Arg(s.Sdid.MustGetNull())
} else {
vals[39] = psql.Raw("DEFAULT")
}
if !s.Sitecond.IsUnset() {
vals[40] = psql.Arg(s.Sitecond.MustGetNull())
} else {
vals[40] = psql.Raw("DEFAULT")
}
if !s.Srid.IsUnset() {
vals[41] = psql.Arg(s.Srid.MustGetNull())
} else {
vals[41] = psql.Raw("DEFAULT")
}
if !s.Startdatetime.IsUnset() {
vals[42] = psql.Arg(s.Startdatetime.MustGetNull())
} else {
vals[42] = psql.Raw("DEFAULT")
}
if !s.Tirecount.IsUnset() {
vals[43] = psql.Arg(s.Tirecount.MustGetNull())
} else {
vals[43] = psql.Raw("DEFAULT")
}
if !s.Totlarvae.IsUnset() {
vals[44] = psql.Arg(s.Totlarvae.MustGetNull())
} else {
vals[44] = psql.Raw("DEFAULT")
}
if !s.Totpupae.IsUnset() {
vals[45] = psql.Arg(s.Totpupae.MustGetNull())
} else {
vals[45] = psql.Raw("DEFAULT")
}
if !s.Visualmonitoring.IsUnset() {
vals[46] = psql.Arg(s.Visualmonitoring.MustGetNull())
} else {
vals[46] = psql.Raw("DEFAULT")
}
if !s.Vmcomments.IsUnset() {
vals[47] = psql.Arg(s.Vmcomments.MustGetNull())
} else {
vals[47] = psql.Raw("DEFAULT")
}
if !s.Winddir.IsUnset() {
vals[48] = psql.Arg(s.Winddir.MustGetNull())
} else {
vals[48] = psql.Raw("DEFAULT")
}
if !s.Windspeed.IsUnset() {
vals[49] = psql.Arg(s.Windspeed.MustGetNull())
} else {
vals[49] = psql.Raw("DEFAULT")
}
if !s.Zone.IsUnset() {
vals[50] = psql.Arg(s.Zone.MustGetNull())
} else {
vals[50] = psql.Raw("DEFAULT")
}
if !s.Zone2.IsUnset() {
vals[51] = psql.Arg(s.Zone2.MustGetNull())
} else {
vals[51] = psql.Raw("DEFAULT")
}
if !s.Created.IsUnset() {
vals[52] = psql.Arg(s.Created.MustGetNull())
} else {
vals[52] = psql.Raw("DEFAULT")
}
if !s.CreatedDate.IsUnset() {
vals[53] = psql.Arg(s.CreatedDate.MustGetNull())
} else {
vals[53] = psql.Raw("DEFAULT")
}
if !s.CreatedUser.IsUnset() {
vals[54] = psql.Arg(s.CreatedUser.MustGetNull())
} else {
vals[54] = psql.Raw("DEFAULT")
}
if !s.GeometryX.IsUnset() {
vals[55] = psql.Arg(s.GeometryX.MustGetNull())
} else {
vals[55] = psql.Raw("DEFAULT")
}
if !s.GeometryY.IsUnset() {
vals[56] = psql.Arg(s.GeometryY.MustGetNull())
} else {
vals[56] = psql.Raw("DEFAULT")
}
if !s.LastEditedDate.IsUnset() {
vals[57] = psql.Arg(s.LastEditedDate.MustGetNull())
} else {
vals[57] = psql.Raw("DEFAULT")
}
if !s.LastEditedUser.IsUnset() {
vals[58] = psql.Arg(s.LastEditedUser.MustGetNull())
} else {
vals[58] = psql.Raw("DEFAULT")
}
if !s.Adminaction.IsUnset() {
vals[59] = psql.Arg(s.Adminaction.MustGetNull())
} else {
vals[59] = psql.Raw("DEFAULT")
}
if !s.Ptaid.IsUnset() {
vals[60] = psql.Arg(s.Ptaid.MustGetNull())
} else {
vals[60] = psql.Raw("DEFAULT")
}
if s.Version.IsValue() {
vals[61] = psql.Arg(s.Version.MustGet())
} else {
vals[61] = psql.Raw("DEFAULT")
}
return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "")
}))
}
func (s HistoryMosquitoinspectionSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] {
return um.Set(s.Expressions()...)
}
func (s HistoryMosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expression {
exprs := make([]bob.Expression, 0, 62)
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.Actiontaken.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "actiontaken")...),
psql.Arg(s.Actiontaken),
}})
}
if !s.Activity.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "activity")...),
psql.Arg(s.Activity),
}})
}
if !s.Adultact.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "adultact")...),
psql.Arg(s.Adultact),
}})
}
if !s.Avetemp.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "avetemp")...),
psql.Arg(s.Avetemp),
}})
}
if !s.Avglarvae.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "avglarvae")...),
psql.Arg(s.Avglarvae),
}})
}
if !s.Avgpupae.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "avgpupae")...),
psql.Arg(s.Avgpupae),
}})
}
if !s.Breeding.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "breeding")...),
psql.Arg(s.Breeding),
}})
}
if !s.Cbcount.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "cbcount")...),
psql.Arg(s.Cbcount),
}})
}
if !s.Comments.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "comments")...),
psql.Arg(s.Comments),
}})
}
if !s.Containercount.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "containercount")...),
psql.Arg(s.Containercount),
}})
}
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.Domstage.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "domstage")...),
psql.Arg(s.Domstage),
}})
}
if !s.Eggs.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "eggs")...),
psql.Arg(s.Eggs),
}})
}
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.Fieldspecies.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "fieldspecies")...),
psql.Arg(s.Fieldspecies),
}})
}
if !s.Fieldtech.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "fieldtech")...),
psql.Arg(s.Fieldtech),
}})
}
if !s.Globalid.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "globalid")...),
psql.Arg(s.Globalid),
}})
}
if !s.Jurisdiction.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "jurisdiction")...),
psql.Arg(s.Jurisdiction),
}})
}
if !s.Larvaepresent.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "larvaepresent")...),
psql.Arg(s.Larvaepresent),
}})
}
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.Lstages.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "lstages")...),
psql.Arg(s.Lstages),
}})
}
if !s.Numdips.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "numdips")...),
psql.Arg(s.Numdips),
}})
}
if s.Objectid.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "objectid")...),
psql.Arg(s.Objectid),
}})
}
if !s.Personalcontact.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "personalcontact")...),
psql.Arg(s.Personalcontact),
}})
}
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.Positivecontainercount.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "positivecontainercount")...),
psql.Arg(s.Positivecontainercount),
}})
}
if !s.Pupaepresent.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "pupaepresent")...),
psql.Arg(s.Pupaepresent),
}})
}
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.Sdid.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "sdid")...),
psql.Arg(s.Sdid),
}})
}
if !s.Sitecond.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "sitecond")...),
psql.Arg(s.Sitecond),
}})
}
if !s.Srid.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "srid")...),
psql.Arg(s.Srid),
}})
}
if !s.Startdatetime.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "startdatetime")...),
psql.Arg(s.Startdatetime),
}})
}
if !s.Tirecount.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "tirecount")...),
psql.Arg(s.Tirecount),
}})
}
if !s.Totlarvae.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "totlarvae")...),
psql.Arg(s.Totlarvae),
}})
}
if !s.Totpupae.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "totpupae")...),
psql.Arg(s.Totpupae),
}})
}
if !s.Visualmonitoring.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "visualmonitoring")...),
psql.Arg(s.Visualmonitoring),
}})
}
if !s.Vmcomments.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "vmcomments")...),
psql.Arg(s.Vmcomments),
}})
}
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.Adminaction.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "adminaction")...),
psql.Arg(s.Adminaction),
}})
}
if !s.Ptaid.IsUnset() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "ptaid")...),
psql.Arg(s.Ptaid),
}})
}
if s.Version.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "version")...),
psql.Arg(s.Version),
}})
}
return exprs
}
// FindHistoryMosquitoinspection retrieves a single record by primary key
// If cols is empty Find will return all columns.
func FindHistoryMosquitoinspection(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32, cols ...string) (*HistoryMosquitoinspection, error) {
if len(cols) == 0 {
return HistoryMosquitoinspections.Query(
sm.Where(HistoryMosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
sm.Where(HistoryMosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))),
).One(ctx, exec)
}
return HistoryMosquitoinspections.Query(
sm.Where(HistoryMosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
sm.Where(HistoryMosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))),
sm.Columns(HistoryMosquitoinspections.Columns.Only(cols...)),
).One(ctx, exec)
}
// HistoryMosquitoinspectionExists checks the presence of a single record by primary key
func HistoryMosquitoinspectionExists(ctx context.Context, exec bob.Executor, ObjectidPK int32, VersionPK int32) (bool, error) {
return HistoryMosquitoinspections.Query(
sm.Where(HistoryMosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
sm.Where(HistoryMosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))),
).Exists(ctx, exec)
}
// AfterQueryHook is called after HistoryMosquitoinspection is retrieved from the database
func (o *HistoryMosquitoinspection) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
var err error
switch queryType {
case bob.QueryTypeSelect:
ctx, err = HistoryMosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, HistoryMosquitoinspectionSlice{o})
case bob.QueryTypeInsert:
ctx, err = HistoryMosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, HistoryMosquitoinspectionSlice{o})
case bob.QueryTypeUpdate:
ctx, err = HistoryMosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, HistoryMosquitoinspectionSlice{o})
case bob.QueryTypeDelete:
ctx, err = HistoryMosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, HistoryMosquitoinspectionSlice{o})
}
return err
}
// primaryKeyVals returns the primary key values of the HistoryMosquitoinspection
func (o *HistoryMosquitoinspection) primaryKeyVals() bob.Expression {
return psql.ArgGroup(
o.Objectid,
o.Version,
)
}
func (o *HistoryMosquitoinspection) pkEQ() dialect.Expression {
return psql.Group(psql.Quote("history_mosquitoinspection", "objectid"), psql.Quote("history_mosquitoinspection", "version")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
return o.primaryKeyVals().WriteSQL(ctx, w, d, start)
}))
}
// Update uses an executor to update the HistoryMosquitoinspection
func (o *HistoryMosquitoinspection) Update(ctx context.Context, exec bob.Executor, s *HistoryMosquitoinspectionSetter) error {
v, err := HistoryMosquitoinspections.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 HistoryMosquitoinspection record with an executor
func (o *HistoryMosquitoinspection) Delete(ctx context.Context, exec bob.Executor) error {
_, err := HistoryMosquitoinspections.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec)
return err
}
// Reload refreshes the HistoryMosquitoinspection using the executor
func (o *HistoryMosquitoinspection) Reload(ctx context.Context, exec bob.Executor) error {
o2, err := HistoryMosquitoinspections.Query(
sm.Where(HistoryMosquitoinspections.Columns.Objectid.EQ(psql.Arg(o.Objectid))),
sm.Where(HistoryMosquitoinspections.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 HistoryMosquitoinspectionSlice is retrieved from the database
func (o HistoryMosquitoinspectionSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
var err error
switch queryType {
case bob.QueryTypeSelect:
ctx, err = HistoryMosquitoinspections.AfterSelectHooks.RunHooks(ctx, exec, o)
case bob.QueryTypeInsert:
ctx, err = HistoryMosquitoinspections.AfterInsertHooks.RunHooks(ctx, exec, o)
case bob.QueryTypeUpdate:
ctx, err = HistoryMosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o)
case bob.QueryTypeDelete:
ctx, err = HistoryMosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o)
}
return err
}
func (o HistoryMosquitoinspectionSlice) pkIN() dialect.Expression {
if len(o) == 0 {
return psql.Raw("NULL")
}
return psql.Group(psql.Quote("history_mosquitoinspection", "objectid"), psql.Quote("history_mosquitoinspection", "version")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
pkPairs := make([]bob.Expression, len(o))
for i, row := range o {
pkPairs[i] = row.primaryKeyVals()
}
return bob.ExpressSlice(ctx, w, d, start, pkPairs, "", ", ", "")
}))
}
// copyMatchingRows finds models in the given slice that have the same primary key
// then it first copies the existing relationships from the old model to the new model
// and then replaces the old model in the slice with the new model
func (o HistoryMosquitoinspectionSlice) copyMatchingRows(from ...*HistoryMosquitoinspection) {
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 HistoryMosquitoinspectionSlice) 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 HistoryMosquitoinspections.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 *HistoryMosquitoinspection:
o.copyMatchingRows(retrieved)
case []*HistoryMosquitoinspection:
o.copyMatchingRows(retrieved...)
case HistoryMosquitoinspectionSlice:
o.copyMatchingRows(retrieved...)
default:
// If the retrieved value is not a HistoryMosquitoinspection or a slice of HistoryMosquitoinspection
// then run the AfterUpdateHooks on the slice
_, err = HistoryMosquitoinspections.AfterUpdateHooks.RunHooks(ctx, exec, o)
}
return err
}))
q.AppendWhere(o.pkIN())
})
}
// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)"
func (o HistoryMosquitoinspectionSlice) 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 HistoryMosquitoinspections.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 *HistoryMosquitoinspection:
o.copyMatchingRows(retrieved)
case []*HistoryMosquitoinspection:
o.copyMatchingRows(retrieved...)
case HistoryMosquitoinspectionSlice:
o.copyMatchingRows(retrieved...)
default:
// If the retrieved value is not a HistoryMosquitoinspection or a slice of HistoryMosquitoinspection
// then run the AfterDeleteHooks on the slice
_, err = HistoryMosquitoinspections.AfterDeleteHooks.RunHooks(ctx, exec, o)
}
return err
}))
q.AppendWhere(o.pkIN())
})
}
func (o HistoryMosquitoinspectionSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals HistoryMosquitoinspectionSetter) error {
if len(o) == 0 {
return nil
}
_, err := HistoryMosquitoinspections.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec)
return err
}
func (o HistoryMosquitoinspectionSlice) DeleteAll(ctx context.Context, exec bob.Executor) error {
if len(o) == 0 {
return nil
}
_, err := HistoryMosquitoinspections.Delete(o.DeleteMod()).Exec(ctx, exec)
return err
}
func (o HistoryMosquitoinspectionSlice) ReloadAll(ctx context.Context, exec bob.Executor) error {
if len(o) == 0 {
return nil
}
o2, err := HistoryMosquitoinspections.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 *HistoryMosquitoinspection) Organization(mods ...bob.Mod[*dialect.SelectQuery]) OrganizationsQuery {
return Organizations.Query(append(mods,
sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.OrganizationID))),
)...)
}
func (os HistoryMosquitoinspectionSlice) 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 attachHistoryMosquitoinspectionOrganization0(ctx context.Context, exec bob.Executor, count int, historyMosquitoinspection0 *HistoryMosquitoinspection, organization1 *Organization) (*HistoryMosquitoinspection, error) {
setter := &HistoryMosquitoinspectionSetter{
OrganizationID: omit.From(organization1.ID),
}
err := historyMosquitoinspection0.Update(ctx, exec, setter)
if err != nil {
return nil, fmt.Errorf("attachHistoryMosquitoinspectionOrganization0: %w", err)
}
return historyMosquitoinspection0, nil
}
func (historyMosquitoinspection0 *HistoryMosquitoinspection) 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 = attachHistoryMosquitoinspectionOrganization0(ctx, exec, 1, historyMosquitoinspection0, organization1)
if err != nil {
return err
}
historyMosquitoinspection0.R.Organization = organization1
organization1.R.HistoryMosquitoinspections = append(organization1.R.HistoryMosquitoinspections, historyMosquitoinspection0)
return nil
}
func (historyMosquitoinspection0 *HistoryMosquitoinspection) AttachOrganization(ctx context.Context, exec bob.Executor, organization1 *Organization) error {
var err error
_, err = attachHistoryMosquitoinspectionOrganization0(ctx, exec, 1, historyMosquitoinspection0, organization1)
if err != nil {
return err
}
historyMosquitoinspection0.R.Organization = organization1
organization1.R.HistoryMosquitoinspections = append(organization1.R.HistoryMosquitoinspections, historyMosquitoinspection0)
return nil
}
type historyMosquitoinspectionWhere[Q psql.Filterable] struct {
OrganizationID psql.WhereMod[Q, int32]
Actiontaken psql.WhereNullMod[Q, string]
Activity psql.WhereNullMod[Q, string]
Adultact psql.WhereNullMod[Q, string]
Avetemp psql.WhereNullMod[Q, float64]
Avglarvae psql.WhereNullMod[Q, float64]
Avgpupae psql.WhereNullMod[Q, float64]
Breeding psql.WhereNullMod[Q, string]
Cbcount psql.WhereNullMod[Q, int16]
Comments psql.WhereNullMod[Q, string]
Containercount psql.WhereNullMod[Q, int16]
Creationdate psql.WhereNullMod[Q, int64]
Creator psql.WhereNullMod[Q, string]
Domstage psql.WhereNullMod[Q, string]
Eggs psql.WhereNullMod[Q, int16]
Enddatetime psql.WhereNullMod[Q, int64]
Editdate psql.WhereNullMod[Q, int64]
Editor psql.WhereNullMod[Q, string]
Fieldspecies psql.WhereNullMod[Q, string]
Fieldtech psql.WhereNullMod[Q, string]
Globalid psql.WhereNullMod[Q, string]
Jurisdiction psql.WhereNullMod[Q, string]
Larvaepresent psql.WhereNullMod[Q, int16]
Linelocid psql.WhereNullMod[Q, string]
Locationname psql.WhereNullMod[Q, string]
Lstages psql.WhereNullMod[Q, string]
Numdips psql.WhereNullMod[Q, int16]
Objectid psql.WhereMod[Q, int32]
Personalcontact psql.WhereNullMod[Q, int16]
Pointlocid psql.WhereNullMod[Q, string]
Polygonlocid psql.WhereNullMod[Q, string]
Posdips psql.WhereNullMod[Q, int16]
Positivecontainercount psql.WhereNullMod[Q, int16]
Pupaepresent 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]
Sdid psql.WhereNullMod[Q, string]
Sitecond psql.WhereNullMod[Q, string]
Srid psql.WhereNullMod[Q, string]
Startdatetime psql.WhereNullMod[Q, int64]
Tirecount psql.WhereNullMod[Q, int16]
Totlarvae psql.WhereNullMod[Q, int16]
Totpupae psql.WhereNullMod[Q, int16]
Visualmonitoring psql.WhereNullMod[Q, int16]
Vmcomments 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]
Adminaction psql.WhereNullMod[Q, string]
Ptaid psql.WhereNullMod[Q, string]
Version psql.WhereMod[Q, int32]
}
func (historyMosquitoinspectionWhere[Q]) AliasedAs(alias string) historyMosquitoinspectionWhere[Q] {
return buildHistoryMosquitoinspectionWhere[Q](buildHistoryMosquitoinspectionColumns(alias))
}
func buildHistoryMosquitoinspectionWhere[Q psql.Filterable](cols historyMosquitoinspectionColumns) historyMosquitoinspectionWhere[Q] {
return historyMosquitoinspectionWhere[Q]{
OrganizationID: psql.Where[Q, int32](cols.OrganizationID),
Actiontaken: psql.WhereNull[Q, string](cols.Actiontaken),
Activity: psql.WhereNull[Q, string](cols.Activity),
Adultact: psql.WhereNull[Q, string](cols.Adultact),
Avetemp: psql.WhereNull[Q, float64](cols.Avetemp),
Avglarvae: psql.WhereNull[Q, float64](cols.Avglarvae),
Avgpupae: psql.WhereNull[Q, float64](cols.Avgpupae),
Breeding: psql.WhereNull[Q, string](cols.Breeding),
Cbcount: psql.WhereNull[Q, int16](cols.Cbcount),
Comments: psql.WhereNull[Q, string](cols.Comments),
Containercount: psql.WhereNull[Q, int16](cols.Containercount),
Creationdate: psql.WhereNull[Q, int64](cols.Creationdate),
Creator: psql.WhereNull[Q, string](cols.Creator),
Domstage: psql.WhereNull[Q, string](cols.Domstage),
Eggs: psql.WhereNull[Q, int16](cols.Eggs),
Enddatetime: psql.WhereNull[Q, int64](cols.Enddatetime),
Editdate: psql.WhereNull[Q, int64](cols.Editdate),
Editor: psql.WhereNull[Q, string](cols.Editor),
Fieldspecies: psql.WhereNull[Q, string](cols.Fieldspecies),
Fieldtech: psql.WhereNull[Q, string](cols.Fieldtech),
Globalid: psql.WhereNull[Q, string](cols.Globalid),
Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction),
Larvaepresent: psql.WhereNull[Q, int16](cols.Larvaepresent),
Linelocid: psql.WhereNull[Q, string](cols.Linelocid),
Locationname: psql.WhereNull[Q, string](cols.Locationname),
Lstages: psql.WhereNull[Q, string](cols.Lstages),
Numdips: psql.WhereNull[Q, int16](cols.Numdips),
Objectid: psql.Where[Q, int32](cols.Objectid),
Personalcontact: psql.WhereNull[Q, int16](cols.Personalcontact),
Pointlocid: psql.WhereNull[Q, string](cols.Pointlocid),
Polygonlocid: psql.WhereNull[Q, string](cols.Polygonlocid),
Posdips: psql.WhereNull[Q, int16](cols.Posdips),
Positivecontainercount: psql.WhereNull[Q, int16](cols.Positivecontainercount),
Pupaepresent: psql.WhereNull[Q, int16](cols.Pupaepresent),
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),
Sdid: psql.WhereNull[Q, string](cols.Sdid),
Sitecond: psql.WhereNull[Q, string](cols.Sitecond),
Srid: psql.WhereNull[Q, string](cols.Srid),
Startdatetime: psql.WhereNull[Q, int64](cols.Startdatetime),
Tirecount: psql.WhereNull[Q, int16](cols.Tirecount),
Totlarvae: psql.WhereNull[Q, int16](cols.Totlarvae),
Totpupae: psql.WhereNull[Q, int16](cols.Totpupae),
Visualmonitoring: psql.WhereNull[Q, int16](cols.Visualmonitoring),
Vmcomments: psql.WhereNull[Q, string](cols.Vmcomments),
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),
Adminaction: psql.WhereNull[Q, string](cols.Adminaction),
Ptaid: psql.WhereNull[Q, string](cols.Ptaid),
Version: psql.Where[Q, int32](cols.Version),
}
}
func (o *HistoryMosquitoinspection) Preload(name string, retrieved any) error {
if o == nil {
return nil
}
switch name {
case "Organization":
rel, ok := retrieved.(*Organization)
if !ok {
return fmt.Errorf("historyMosquitoinspection cannot load %T as %q", retrieved, name)
}
o.R.Organization = rel
if rel != nil {
rel.R.HistoryMosquitoinspections = HistoryMosquitoinspectionSlice{o}
}
return nil
default:
return fmt.Errorf("historyMosquitoinspection has no relationship %q", name)
}
}
type historyMosquitoinspectionPreloader struct {
Organization func(...psql.PreloadOption) psql.Preloader
}
func buildHistoryMosquitoinspectionPreloader() historyMosquitoinspectionPreloader {
return historyMosquitoinspectionPreloader{
Organization: func(opts ...psql.PreloadOption) psql.Preloader {
return psql.Preload[*Organization, OrganizationSlice](psql.PreloadRel{
Name: "Organization",
Sides: []psql.PreloadSide{
{
From: HistoryMosquitoinspections,
To: Organizations,
FromColumns: []string{"organization_id"},
ToColumns: []string{"id"},
},
},
}, Organizations.Columns.Names(), opts...)
},
}
}
type historyMosquitoinspectionThenLoader[Q orm.Loadable] struct {
Organization func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
}
func buildHistoryMosquitoinspectionThenLoader[Q orm.Loadable]() historyMosquitoinspectionThenLoader[Q] {
type OrganizationLoadInterface interface {
LoadOrganization(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
}
return historyMosquitoinspectionThenLoader[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 historyMosquitoinspection's Organization into the .R struct
func (o *HistoryMosquitoinspection) 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.HistoryMosquitoinspections = HistoryMosquitoinspectionSlice{o}
o.R.Organization = related
return nil
}
// LoadOrganization loads the historyMosquitoinspection's Organization into the .R struct
func (os HistoryMosquitoinspectionSlice) 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.HistoryMosquitoinspections = append(rel.R.HistoryMosquitoinspections, o)
o.R.Organization = rel
break
}
}
return nil
}
type historyMosquitoinspectionJoins[Q dialect.Joinable] struct {
typ string
Organization modAs[Q, organizationColumns]
}
func (j historyMosquitoinspectionJoins[Q]) aliasedAs(alias string) historyMosquitoinspectionJoins[Q] {
return buildHistoryMosquitoinspectionJoins[Q](buildHistoryMosquitoinspectionColumns(alias), j.typ)
}
func buildHistoryMosquitoinspectionJoins[Q dialect.Joinable](cols historyMosquitoinspectionColumns, typ string) historyMosquitoinspectionJoins[Q] {
return historyMosquitoinspectionJoins[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
},
},
}
}