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
@ -98,6 +98,8 @@ type FieldseekerPolygonlocation struct {
Jurisdiction null.Val[string] `db:"jurisdiction" `
ShapeArea null.Val[float64] `db:"shape__area" `
ShapeLength null.Val[float64] `db:"shape__length" `
// Tracks version changes to the row. Increases when data is modified.
Version int32 `db:"version,pk" `
}
// FieldseekerPolygonlocationSlice is an alias for a slice of pointers to FieldseekerPolygonlocation.
@ -113,7 +115,7 @@ type FieldseekerPolygonlocationsQuery = *psql.ViewQuery[*FieldseekerPolygonlocat
func buildFieldseekerPolygonlocationColumns(alias string) fieldseekerPolygonlocationColumns {
return fieldseekerPolygonlocationColumns{
ColumnsExpr: expr.NewColumnsExpr(
"objectid", "name", "zone", "habitat", "priority", "usetype", "active", "description", "accessdesc", "comments", "symbology", "externalid", "acres", "nextactiondatescheduled", "larvinspectinterval", "zone2", "locationnumber", "globalid", "lastinspectdate", "lastinspectbreeding", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectlstages", "lastinspectactiontaken", "lastinspectfieldspecies", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "hectares", "lastinspectactivity", "lasttreatactivity", "lastinspectconditions", "waterorigin", "filter", "creationdate", "creator", "editdate", "editor", "jurisdiction", "shape__area", "shape__length",
"objectid", "name", "zone", "habitat", "priority", "usetype", "active", "description", "accessdesc", "comments", "symbology", "externalid", "acres", "nextactiondatescheduled", "larvinspectinterval", "zone2", "locationnumber", "globalid", "lastinspectdate", "lastinspectbreeding", "lastinspectavglarvae", "lastinspectavgpupae", "lastinspectlstages", "lastinspectactiontaken", "lastinspectfieldspecies", "lasttreatdate", "lasttreatproduct", "lasttreatqty", "lasttreatqtyunit", "hectares", "lastinspectactivity", "lasttreatactivity", "lastinspectconditions", "waterorigin", "filter", "creationdate", "creator", "editdate", "editor", "jurisdiction", "shape__area", "shape__length", "version",
).WithParent("fieldseeker.polygonlocation"),
tableAlias: alias,
Objectid: psql.Quote(alias, "objectid"),
@ -158,6 +160,7 @@ func buildFieldseekerPolygonlocationColumns(alias string) fieldseekerPolygonloca
Jurisdiction: psql.Quote(alias, "jurisdiction"),
ShapeArea: psql.Quote(alias, "shape__area"),
ShapeLength: psql.Quote(alias, "shape__length"),
Version: psql.Quote(alias, "version"),
}
}
@ -206,6 +209,7 @@ type fieldseekerPolygonlocationColumns struct {
Jurisdiction psql.Expression
ShapeArea psql.Expression
ShapeLength psql.Expression
Version psql.Expression
}
func (c fieldseekerPolygonlocationColumns) Alias() string {
@ -262,10 +266,11 @@ type FieldseekerPolygonlocationSetter struct {
Jurisdiction omitnull.Val[string] `db:"jurisdiction" `
ShapeArea omitnull.Val[float64] `db:"shape__area" `
ShapeLength omitnull.Val[float64] `db:"shape__length" `
Version omit.Val[int32] `db:"version,pk" `
}
func (s FieldseekerPolygonlocationSetter) SetColumns() []string {
vals := make([]string, 0, 42)
vals := make([]string, 0, 43)
if s.Objectid.IsValue() {
vals = append(vals, "objectid")
}
@ -392,6 +397,9 @@ func (s FieldseekerPolygonlocationSetter) SetColumns() []string {
if !s.ShapeLength.IsUnset() {
vals = append(vals, "shape__length")
}
if s.Version.IsValue() {
vals = append(vals, "version")
}
return vals
}
@ -522,6 +530,9 @@ func (s FieldseekerPolygonlocationSetter) Overwrite(t *FieldseekerPolygonlocatio
if !s.ShapeLength.IsUnset() {
t.ShapeLength = s.ShapeLength.MustGetNull()
}
if s.Version.IsValue() {
t.Version = s.Version.MustGet()
}
}
func (s *FieldseekerPolygonlocationSetter) Apply(q *dialect.InsertQuery) {
@ -530,7 +541,7 @@ func (s *FieldseekerPolygonlocationSetter) 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, 42)
vals := make([]bob.Expression, 43)
if s.Objectid.IsValue() {
vals[0] = psql.Arg(s.Objectid.MustGet())
} else {
@ -783,6 +794,12 @@ func (s *FieldseekerPolygonlocationSetter) Apply(q *dialect.InsertQuery) {
vals[41] = psql.Raw("DEFAULT")
}
if s.Version.IsValue() {
vals[42] = psql.Arg(s.Version.MustGet())
} else {
vals[42] = psql.Raw("DEFAULT")
}
return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "")
}))
}
@ -792,7 +809,7 @@ func (s FieldseekerPolygonlocationSetter) UpdateMod() bob.Mod[*dialect.UpdateQue
}
func (s FieldseekerPolygonlocationSetter) Expressions(prefix ...string) []bob.Expression {
exprs := make([]bob.Expression, 0, 42)
exprs := make([]bob.Expression, 0, 43)
if s.Objectid.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
@ -1088,28 +1105,38 @@ func (s FieldseekerPolygonlocationSetter) Expressions(prefix ...string) []bob.Ex
}})
}
if s.Version.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "version")...),
psql.Arg(s.Version),
}})
}
return exprs
}
// FindFieldseekerPolygonlocation retrieves a single record by primary key
// If cols is empty Find will return all columns.
func FindFieldseekerPolygonlocation(ctx context.Context, exec bob.Executor, ObjectidPK int64, cols ...string) (*FieldseekerPolygonlocation, error) {
func FindFieldseekerPolygonlocation(ctx context.Context, exec bob.Executor, ObjectidPK int64, VersionPK int32, cols ...string) (*FieldseekerPolygonlocation, error) {
if len(cols) == 0 {
return FieldseekerPolygonlocations.Query(
sm.Where(FieldseekerPolygonlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
sm.Where(FieldseekerPolygonlocations.Columns.Version.EQ(psql.Arg(VersionPK))),
).One(ctx, exec)
}
return FieldseekerPolygonlocations.Query(
sm.Where(FieldseekerPolygonlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
sm.Where(FieldseekerPolygonlocations.Columns.Version.EQ(psql.Arg(VersionPK))),
sm.Columns(FieldseekerPolygonlocations.Columns.Only(cols...)),
).One(ctx, exec)
}
// FieldseekerPolygonlocationExists checks the presence of a single record by primary key
func FieldseekerPolygonlocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int64) (bool, error) {
func FieldseekerPolygonlocationExists(ctx context.Context, exec bob.Executor, ObjectidPK int64, VersionPK int32) (bool, error) {
return FieldseekerPolygonlocations.Query(
sm.Where(FieldseekerPolygonlocations.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
sm.Where(FieldseekerPolygonlocations.Columns.Version.EQ(psql.Arg(VersionPK))),
).Exists(ctx, exec)
}
@ -1133,11 +1160,14 @@ func (o *FieldseekerPolygonlocation) AfterQueryHook(ctx context.Context, exec bo
// primaryKeyVals returns the primary key values of the FieldseekerPolygonlocation
func (o *FieldseekerPolygonlocation) primaryKeyVals() bob.Expression {
return psql.Arg(o.Objectid)
return psql.ArgGroup(
o.Objectid,
o.Version,
)
}
func (o *FieldseekerPolygonlocation) pkEQ() dialect.Expression {
return psql.Quote("fieldseeker.polygonlocation", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
return psql.Group(psql.Quote("fieldseeker.polygonlocation", "objectid"), psql.Quote("fieldseeker.polygonlocation", "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)
}))
}
@ -1164,6 +1194,7 @@ func (o *FieldseekerPolygonlocation) Delete(ctx context.Context, exec bob.Execut
func (o *FieldseekerPolygonlocation) Reload(ctx context.Context, exec bob.Executor) error {
o2, err := FieldseekerPolygonlocations.Query(
sm.Where(FieldseekerPolygonlocations.Columns.Objectid.EQ(psql.Arg(o.Objectid))),
sm.Where(FieldseekerPolygonlocations.Columns.Version.EQ(psql.Arg(o.Version))),
).One(ctx, exec)
if err != nil {
return err
@ -1197,7 +1228,7 @@ func (o FieldseekerPolygonlocationSlice) pkIN() dialect.Expression {
return psql.Raw("NULL")
}
return psql.Quote("fieldseeker.polygonlocation", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
return psql.Group(psql.Quote("fieldseeker.polygonlocation", "objectid"), psql.Quote("fieldseeker.polygonlocation", "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()
@ -1215,6 +1246,9 @@ func (o FieldseekerPolygonlocationSlice) copyMatchingRows(from ...*FieldseekerPo
if new.Objectid != old.Objectid {
continue
}
if new.Version != old.Version {
continue
}
o[i] = new
break
@ -1356,6 +1390,7 @@ type fieldseekerPolygonlocationWhere[Q psql.Filterable] struct {
Jurisdiction psql.WhereNullMod[Q, string]
ShapeArea psql.WhereNullMod[Q, float64]
ShapeLength psql.WhereNullMod[Q, float64]
Version psql.WhereMod[Q, int32]
}
func (fieldseekerPolygonlocationWhere[Q]) AliasedAs(alias string) fieldseekerPolygonlocationWhere[Q] {
@ -1406,5 +1441,6 @@ func buildFieldseekerPolygonlocationWhere[Q psql.Filterable](cols fieldseekerPol
Jurisdiction: psql.WhereNull[Q, string](cols.Jurisdiction),
ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea),
ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength),
Version: psql.Where[Q, int32](cols.Version),
}
}