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
@ -128,6 +128,8 @@ type FieldseekerQamosquitoinspection struct {
Creator null.Val[string] `db:"creator" `
Editdate null.Val[time.Time] `db:"editdate" `
Editor null.Val[string] `db:"editor" `
// Tracks version changes to the row. Increases when data is modified.
Version int32 `db:"version,pk" `
}
// FieldseekerQamosquitoinspectionSlice is an alias for a slice of pointers to FieldseekerQamosquitoinspection.
@ -143,7 +145,7 @@ type FieldseekerQamosquitoinspectionsQuery = *psql.ViewQuery[*FieldseekerQamosqu
func buildFieldseekerQamosquitoinspectionColumns(alias string) fieldseekerQamosquitoinspectionColumns {
return fieldseekerQamosquitoinspectionColumns{
ColumnsExpr: expr.NewColumnsExpr(
"objectid", "posdips", "actiontaken", "comments", "avetemp", "windspeed", "raingauge", "globalid", "startdatetime", "enddatetime", "winddir", "reviewed", "reviewedby", "revieweddate", "locationname", "zone", "recordstatus", "zone2", "lr", "negdips", "totalacres", "acresbreeding", "fish", "sitetype", "breedingpotential", "movingwater", "nowaterever", "mosquitohabitat", "habvalue1", "habvalue1percent", "habvalue2", "habvalue2percent", "potential", "larvaepresent", "larvaeinsidetreatedarea", "larvaeoutsidetreatedarea", "larvaereason", "aquaticorganisms", "vegetation", "sourcereduction", "waterpresent", "watermovement1", "watermovement1percent", "watermovement2", "watermovement2percent", "soilconditions", "waterduration", "watersource", "waterconditions", "adultactivity", "linelocid", "pointlocid", "polygonlocid", "created_user", "created_date", "last_edited_user", "last_edited_date", "fieldtech", "creationdate", "creator", "editdate", "editor",
"objectid", "posdips", "actiontaken", "comments", "avetemp", "windspeed", "raingauge", "globalid", "startdatetime", "enddatetime", "winddir", "reviewed", "reviewedby", "revieweddate", "locationname", "zone", "recordstatus", "zone2", "lr", "negdips", "totalacres", "acresbreeding", "fish", "sitetype", "breedingpotential", "movingwater", "nowaterever", "mosquitohabitat", "habvalue1", "habvalue1percent", "habvalue2", "habvalue2percent", "potential", "larvaepresent", "larvaeinsidetreatedarea", "larvaeoutsidetreatedarea", "larvaereason", "aquaticorganisms", "vegetation", "sourcereduction", "waterpresent", "watermovement1", "watermovement1percent", "watermovement2", "watermovement2percent", "soilconditions", "waterduration", "watersource", "waterconditions", "adultactivity", "linelocid", "pointlocid", "polygonlocid", "created_user", "created_date", "last_edited_user", "last_edited_date", "fieldtech", "creationdate", "creator", "editdate", "editor", "version",
).WithParent("fieldseeker.qamosquitoinspection"),
tableAlias: alias,
Objectid: psql.Quote(alias, "objectid"),
@ -208,6 +210,7 @@ func buildFieldseekerQamosquitoinspectionColumns(alias string) fieldseekerQamosq
Creator: psql.Quote(alias, "creator"),
Editdate: psql.Quote(alias, "editdate"),
Editor: psql.Quote(alias, "editor"),
Version: psql.Quote(alias, "version"),
}
}
@ -276,6 +279,7 @@ type fieldseekerQamosquitoinspectionColumns struct {
Creator psql.Expression
Editdate psql.Expression
Editor psql.Expression
Version psql.Expression
}
func (c fieldseekerQamosquitoinspectionColumns) Alias() string {
@ -352,10 +356,11 @@ type FieldseekerQamosquitoinspectionSetter struct {
Creator omitnull.Val[string] `db:"creator" `
Editdate omitnull.Val[time.Time] `db:"editdate" `
Editor omitnull.Val[string] `db:"editor" `
Version omit.Val[int32] `db:"version,pk" `
}
func (s FieldseekerQamosquitoinspectionSetter) SetColumns() []string {
vals := make([]string, 0, 62)
vals := make([]string, 0, 63)
if s.Objectid.IsValue() {
vals = append(vals, "objectid")
}
@ -542,6 +547,9 @@ func (s FieldseekerQamosquitoinspectionSetter) SetColumns() []string {
if !s.Editor.IsUnset() {
vals = append(vals, "editor")
}
if s.Version.IsValue() {
vals = append(vals, "version")
}
return vals
}
@ -732,6 +740,9 @@ func (s FieldseekerQamosquitoinspectionSetter) Overwrite(t *FieldseekerQamosquit
if !s.Editor.IsUnset() {
t.Editor = s.Editor.MustGetNull()
}
if s.Version.IsValue() {
t.Version = s.Version.MustGet()
}
}
func (s *FieldseekerQamosquitoinspectionSetter) Apply(q *dialect.InsertQuery) {
@ -740,7 +751,7 @@ func (s *FieldseekerQamosquitoinspectionSetter) Apply(q *dialect.InsertQuery) {
})
q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
vals := make([]bob.Expression, 62)
vals := make([]bob.Expression, 63)
if s.Objectid.IsValue() {
vals[0] = psql.Arg(s.Objectid.MustGet())
} else {
@ -1113,6 +1124,12 @@ func (s *FieldseekerQamosquitoinspectionSetter) Apply(q *dialect.InsertQuery) {
vals[61] = psql.Raw("DEFAULT")
}
if s.Version.IsValue() {
vals[62] = psql.Arg(s.Version.MustGet())
} else {
vals[62] = psql.Raw("DEFAULT")
}
return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "")
}))
}
@ -1122,7 +1139,7 @@ func (s FieldseekerQamosquitoinspectionSetter) UpdateMod() bob.Mod[*dialect.Upda
}
func (s FieldseekerQamosquitoinspectionSetter) Expressions(prefix ...string) []bob.Expression {
exprs := make([]bob.Expression, 0, 62)
exprs := make([]bob.Expression, 0, 63)
if s.Objectid.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
@ -1558,28 +1575,38 @@ func (s FieldseekerQamosquitoinspectionSetter) Expressions(prefix ...string) []b
}})
}
if s.Version.IsValue() {
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
psql.Quote(append(prefix, "version")...),
psql.Arg(s.Version),
}})
}
return exprs
}
// FindFieldseekerQamosquitoinspection retrieves a single record by primary key
// If cols is empty Find will return all columns.
func FindFieldseekerQamosquitoinspection(ctx context.Context, exec bob.Executor, ObjectidPK int64, cols ...string) (*FieldseekerQamosquitoinspection, error) {
func FindFieldseekerQamosquitoinspection(ctx context.Context, exec bob.Executor, ObjectidPK int64, VersionPK int32, cols ...string) (*FieldseekerQamosquitoinspection, error) {
if len(cols) == 0 {
return FieldseekerQamosquitoinspections.Query(
sm.Where(FieldseekerQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
sm.Where(FieldseekerQamosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))),
).One(ctx, exec)
}
return FieldseekerQamosquitoinspections.Query(
sm.Where(FieldseekerQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
sm.Where(FieldseekerQamosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))),
sm.Columns(FieldseekerQamosquitoinspections.Columns.Only(cols...)),
).One(ctx, exec)
}
// FieldseekerQamosquitoinspectionExists checks the presence of a single record by primary key
func FieldseekerQamosquitoinspectionExists(ctx context.Context, exec bob.Executor, ObjectidPK int64) (bool, error) {
func FieldseekerQamosquitoinspectionExists(ctx context.Context, exec bob.Executor, ObjectidPK int64, VersionPK int32) (bool, error) {
return FieldseekerQamosquitoinspections.Query(
sm.Where(FieldseekerQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
sm.Where(FieldseekerQamosquitoinspections.Columns.Version.EQ(psql.Arg(VersionPK))),
).Exists(ctx, exec)
}
@ -1603,11 +1630,14 @@ func (o *FieldseekerQamosquitoinspection) AfterQueryHook(ctx context.Context, ex
// primaryKeyVals returns the primary key values of the FieldseekerQamosquitoinspection
func (o *FieldseekerQamosquitoinspection) primaryKeyVals() bob.Expression {
return psql.Arg(o.Objectid)
return psql.ArgGroup(
o.Objectid,
o.Version,
)
}
func (o *FieldseekerQamosquitoinspection) pkEQ() dialect.Expression {
return psql.Quote("fieldseeker.qamosquitoinspection", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
return psql.Group(psql.Quote("fieldseeker.qamosquitoinspection", "objectid"), psql.Quote("fieldseeker.qamosquitoinspection", "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)
}))
}
@ -1634,6 +1664,7 @@ func (o *FieldseekerQamosquitoinspection) Delete(ctx context.Context, exec bob.E
func (o *FieldseekerQamosquitoinspection) Reload(ctx context.Context, exec bob.Executor) error {
o2, err := FieldseekerQamosquitoinspections.Query(
sm.Where(FieldseekerQamosquitoinspections.Columns.Objectid.EQ(psql.Arg(o.Objectid))),
sm.Where(FieldseekerQamosquitoinspections.Columns.Version.EQ(psql.Arg(o.Version))),
).One(ctx, exec)
if err != nil {
return err
@ -1667,7 +1698,7 @@ func (o FieldseekerQamosquitoinspectionSlice) pkIN() dialect.Expression {
return psql.Raw("NULL")
}
return psql.Quote("fieldseeker.qamosquitoinspection", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
return psql.Group(psql.Quote("fieldseeker.qamosquitoinspection", "objectid"), psql.Quote("fieldseeker.qamosquitoinspection", "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()
@ -1685,6 +1716,9 @@ func (o FieldseekerQamosquitoinspectionSlice) copyMatchingRows(from ...*Fieldsee
if new.Objectid != old.Objectid {
continue
}
if new.Version != old.Version {
continue
}
o[i] = new
break
@ -1846,6 +1880,7 @@ type fieldseekerQamosquitoinspectionWhere[Q psql.Filterable] struct {
Creator psql.WhereNullMod[Q, string]
Editdate psql.WhereNullMod[Q, time.Time]
Editor psql.WhereNullMod[Q, string]
Version psql.WhereMod[Q, int32]
}
func (fieldseekerQamosquitoinspectionWhere[Q]) AliasedAs(alias string) fieldseekerQamosquitoinspectionWhere[Q] {
@ -1916,5 +1951,6 @@ func buildFieldseekerQamosquitoinspectionWhere[Q psql.Filterable](cols fieldseek
Creator: psql.WhereNull[Q, string](cols.Creator),
Editdate: psql.WhereNull[Q, time.Time](cols.Editdate),
Editor: psql.WhereNull[Q, string](cols.Editor),
Version: psql.Where[Q, int32](cols.Version),
}
}