Initially made it through full update with new fieldseeker schema

This commit is contained in:
Eli Ribble 2025-12-05 23:11:57 +00:00
parent 0904f086b2
commit bd16f69e28
No known key found for this signature in database
510 changed files with 13617 additions and 14851 deletions

View file

@ -1,4 +1,4 @@
// Code generated by BobGen psql v0.42.0. DO NOT EDIT.
// 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
@ -122,6 +122,8 @@ type FieldseekerMosquitoinspection struct {
Vmcomments null.Val[string] `db:"vmcomments" `
Adminaction null.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B] `db:"adminaction" `
Ptaid null.Val[uuid.UUID] `db:"ptaid" `
// Tracks version changes to the row. Increases when data is modified.
Version int32 `db:"version,pk" `
}
// FieldseekerMosquitoinspectionSlice is an alias for a slice of pointers to FieldseekerMosquitoinspection.
@ -137,7 +139,7 @@ type FieldseekerMosquitoinspectionsQuery = *psql.ViewQuery[*FieldseekerMosquitoi
func buildFieldseekerMosquitoinspectionColumns(alias string) fieldseekerMosquitoinspectionColumns {
return fieldseekerMosquitoinspectionColumns{
ColumnsExpr: expr.NewColumnsExpr(
"objectid", "numdips", "activity", "breeding", "totlarvae", "totpupae", "eggs", "posdips", "adultact", "lstages", "domstage", "actiontaken", "comments", "avetemp", "windspeed", "raingauge", "startdatetime", "enddatetime", "winddir", "avglarvae", "avgpupae", "reviewed", "reviewedby", "revieweddate", "locationname", "zone", "recordstatus", "zone2", "personalcontact", "tirecount", "cbcount", "containercount", "fieldspecies", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "linelocid", "pointlocid", "polygonlocid", "srid", "fieldtech", "larvaepresent", "pupaepresent", "sdid", "sitecond", "positivecontainercount", "creationdate", "creator", "editdate", "editor", "jurisdiction", "visualmonitoring", "vmcomments", "adminaction", "ptaid",
"objectid", "numdips", "activity", "breeding", "totlarvae", "totpupae", "eggs", "posdips", "adultact", "lstages", "domstage", "actiontaken", "comments", "avetemp", "windspeed", "raingauge", "startdatetime", "enddatetime", "winddir", "avglarvae", "avgpupae", "reviewed", "reviewedby", "revieweddate", "locationname", "zone", "recordstatus", "zone2", "personalcontact", "tirecount", "cbcount", "containercount", "fieldspecies", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "linelocid", "pointlocid", "polygonlocid", "srid", "fieldtech", "larvaepresent", "pupaepresent", "sdid", "sitecond", "positivecontainercount", "creationdate", "creator", "editdate", "editor", "jurisdiction", "visualmonitoring", "vmcomments", "adminaction", "ptaid", "version",
).WithParent("fieldseeker.mosquitoinspection"),
tableAlias: alias,
Objectid: psql.Quote(alias, "objectid"),
@ -197,6 +199,7 @@ func buildFieldseekerMosquitoinspectionColumns(alias string) fieldseekerMosquito
Vmcomments: psql.Quote(alias, "vmcomments"),
Adminaction: psql.Quote(alias, "adminaction"),
Ptaid: psql.Quote(alias, "ptaid"),
Version: psql.Quote(alias, "version"),
}
}
@ -260,6 +263,7 @@ type fieldseekerMosquitoinspectionColumns struct {
Vmcomments psql.Expression
Adminaction psql.Expression
Ptaid psql.Expression
Version psql.Expression
}
func (c fieldseekerMosquitoinspectionColumns) Alias() string {
@ -331,10 +335,11 @@ type FieldseekerMosquitoinspectionSetter struct {
Vmcomments omitnull.Val[string] `db:"vmcomments" `
Adminaction omitnull.Val[enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B] `db:"adminaction" `
Ptaid omitnull.Val[uuid.UUID] `db:"ptaid" `
Version omit.Val[int32] `db:"version,pk" `
}
func (s FieldseekerMosquitoinspectionSetter) SetColumns() []string {
vals := make([]string, 0, 57)
vals := make([]string, 0, 58)
if s.Objectid.IsValue() {
vals = append(vals, "objectid")
}
@ -506,6 +511,9 @@ func (s FieldseekerMosquitoinspectionSetter) SetColumns() []string {
if !s.Ptaid.IsUnset() {
vals = append(vals, "ptaid")
}
if s.Version.IsValue() {
vals = append(vals, "version")
}
return vals
}
@ -681,6 +689,9 @@ func (s FieldseekerMosquitoinspectionSetter) Overwrite(t *FieldseekerMosquitoins
if !s.Ptaid.IsUnset() {
t.Ptaid = s.Ptaid.MustGetNull()
}
if s.Version.IsValue() {
t.Version = s.Version.MustGet()
}
}
func (s *FieldseekerMosquitoinspectionSetter) Apply(q *dialect.InsertQuery) {
@ -689,7 +700,7 @@ func (s *FieldseekerMosquitoinspectionSetter) Apply(q *dialect.InsertQuery) {
})
q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
vals := make([]bob.Expression, 57)
vals := make([]bob.Expression, 58)
if s.Objectid.IsValue() {
vals[0] = psql.Arg(s.Objectid.MustGet())
} else {
@ -1032,6 +1043,12 @@ func (s *FieldseekerMosquitoinspectionSetter) Apply(q *dialect.InsertQuery) {
vals[56] = psql.Raw("DEFAULT")
}
if s.Version.IsValue() {
vals[57] = psql.Arg(s.Version.MustGet())
} else {
vals[57] = psql.Raw("DEFAULT")
}
return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "")
}))
}
@ -1041,7 +1058,7 @@ func (s FieldseekerMosquitoinspectionSetter) UpdateMod() bob.Mod[*dialect.Update
}
func (s FieldseekerMosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expression {
exprs := make([]bob.Expression, 0, 57)
exprs := make([]bob.Expression, 0, 58)
if s.Objectid.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
@ -1442,28 +1459,38 @@ func (s FieldseekerMosquitoinspectionSetter) Expressions(prefix ...string) []bob
}})
}
if s.Version.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "version")...),
psql.Arg(s.Version),
}})
}
return exprs
}
// FindFieldseekerMosquitoinspection retrieves a single record by primary key
// If cols is empty Find will return all columns.
func FindFieldseekerMosquitoinspection(ctx context.Context, exec bob.Executor, ObjectidPK int64, cols ...string) (*FieldseekerMosquitoinspection, error) {
func FindFieldseekerMosquitoinspection(ctx context.Context, exec bob.Executor, ObjectidPK int64, VersionPK int32, cols ...string) (*FieldseekerMosquitoinspection, error) {
if len(cols) == 0 {
return FieldseekerMosquitoinspections.Query(
sm.Where(FieldseekerMosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
sm.Where(FieldseekerMosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))),
).One(ctx, exec)
}
return FieldseekerMosquitoinspections.Query(
sm.Where(FieldseekerMosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
sm.Where(FieldseekerMosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))),
sm.Columns(FieldseekerMosquitoinspections.Columns.Only(cols...)),
).One(ctx, exec)
}
// FieldseekerMosquitoinspectionExists checks the presence of a single record by primary key
func FieldseekerMosquitoinspectionExists(ctx context.Context, exec bob.Executor, ObjectidPK int64) (bool, error) {
func FieldseekerMosquitoinspectionExists(ctx context.Context, exec bob.Executor, ObjectidPK int64, VersionPK int32) (bool, error) {
return FieldseekerMosquitoinspections.Query(
sm.Where(FieldseekerMosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
sm.Where(FieldseekerMosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))),
).Exists(ctx, exec)
}
@ -1487,11 +1514,14 @@ func (o *FieldseekerMosquitoinspection) AfterQueryHook(ctx context.Context, exec
// primaryKeyVals returns the primary key values of the FieldseekerMosquitoinspection
func (o *FieldseekerMosquitoinspection) primaryKeyVals() bob.Expression {
return psql.Arg(o.Objectid)
return psql.ArgGroup(
o.Objectid,
o.Version,
)
}
func (o *FieldseekerMosquitoinspection) pkEQ() dialect.Expression {
return psql.Quote("fieldseeker.mosquitoinspection", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
return psql.Group(psql.Quote("fieldseeker.mosquitoinspection", "objectid"), psql.Quote("fieldseeker.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)
}))
}
@ -1518,6 +1548,7 @@ func (o *FieldseekerMosquitoinspection) Delete(ctx context.Context, exec bob.Exe
func (o *FieldseekerMosquitoinspection) Reload(ctx context.Context, exec bob.Executor) error {
o2, err := FieldseekerMosquitoinspections.Query(
sm.Where(FieldseekerMosquitoinspections.Columns.Objectid.EQ(psql.Arg(o.Objectid))),
sm.Where(FieldseekerMosquitoinspections.Columns.Version.EQ(psql.Arg(o.Version))),
).One(ctx, exec)
if err != nil {
return err
@ -1551,7 +1582,7 @@ func (o FieldseekerMosquitoinspectionSlice) pkIN() dialect.Expression {
return psql.Raw("NULL")
}
return psql.Quote("fieldseeker.mosquitoinspection", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
return psql.Group(psql.Quote("fieldseeker.mosquitoinspection", "objectid"), psql.Quote("fieldseeker.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()
@ -1569,6 +1600,9 @@ func (o FieldseekerMosquitoinspectionSlice) copyMatchingRows(from ...*Fieldseeke
if new.Objectid != old.Objectid {
continue
}
if new.Version != old.Version {
continue
}
o[i] = new
break
@ -1725,6 +1759,7 @@ type fieldseekerMosquitoinspectionWhere[Q psql.Filterable] struct {
Vmcomments psql.WhereNullMod[Q, string]
Adminaction psql.WhereNullMod[Q, enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B]
Ptaid psql.WhereNullMod[Q, uuid.UUID]
Version psql.WhereMod[Q, int32]
}
func (fieldseekerMosquitoinspectionWhere[Q]) AliasedAs(alias string) fieldseekerMosquitoinspectionWhere[Q] {
@ -1790,5 +1825,6 @@ func buildFieldseekerMosquitoinspectionWhere[Q psql.Filterable](cols fieldseeker
Vmcomments: psql.WhereNull[Q, string](cols.Vmcomments),
Adminaction: psql.WhereNull[Q, enums.FieldseekerMosquitoinspectionMosquitoinspectionAdminactionB74ae1bbC98B](cols.Adminaction),
Ptaid: psql.WhereNull[Q, uuid.UUID](cols.Ptaid),
Version: psql.Where[Q, int32](cols.Version),
}
}