Initially made it through full update with new fieldseeker schema
This commit is contained in:
parent
0904f086b2
commit
bd16f69e28
510 changed files with 13617 additions and 14851 deletions
|
|
@ -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
|
||||
|
|
@ -42,6 +42,8 @@ type FieldseekerTreatmentarea struct {
|
|||
Editor null.Val[string] `db:"editor" `
|
||||
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" `
|
||||
}
|
||||
|
||||
// FieldseekerTreatmentareaSlice is an alias for a slice of pointers to FieldseekerTreatmentarea.
|
||||
|
|
@ -57,7 +59,7 @@ type FieldseekerTreatmentareasQuery = *psql.ViewQuery[*FieldseekerTreatmentarea,
|
|||
func buildFieldseekerTreatmentareaColumns(alias string) fieldseekerTreatmentareaColumns {
|
||||
return fieldseekerTreatmentareaColumns{
|
||||
ColumnsExpr: expr.NewColumnsExpr(
|
||||
"objectid", "treat_id", "session_id", "treatdate", "comments", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "notified", "type", "creationdate", "creator", "editdate", "editor", "shape__area", "shape__length",
|
||||
"objectid", "treat_id", "session_id", "treatdate", "comments", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "notified", "type", "creationdate", "creator", "editdate", "editor", "shape__area", "shape__length", "version",
|
||||
).WithParent("fieldseeker.treatmentarea"),
|
||||
tableAlias: alias,
|
||||
Objectid: psql.Quote(alias, "objectid"),
|
||||
|
|
@ -78,6 +80,7 @@ func buildFieldseekerTreatmentareaColumns(alias string) fieldseekerTreatmentarea
|
|||
Editor: psql.Quote(alias, "editor"),
|
||||
ShapeArea: psql.Quote(alias, "shape__area"),
|
||||
ShapeLength: psql.Quote(alias, "shape__length"),
|
||||
Version: psql.Quote(alias, "version"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -102,6 +105,7 @@ type fieldseekerTreatmentareaColumns struct {
|
|||
Editor psql.Expression
|
||||
ShapeArea psql.Expression
|
||||
ShapeLength psql.Expression
|
||||
Version psql.Expression
|
||||
}
|
||||
|
||||
func (c fieldseekerTreatmentareaColumns) Alias() string {
|
||||
|
|
@ -134,10 +138,11 @@ type FieldseekerTreatmentareaSetter struct {
|
|||
Editor omitnull.Val[string] `db:"editor" `
|
||||
ShapeArea omitnull.Val[float64] `db:"shape__area" `
|
||||
ShapeLength omitnull.Val[float64] `db:"shape__length" `
|
||||
Version omit.Val[int32] `db:"version,pk" `
|
||||
}
|
||||
|
||||
func (s FieldseekerTreatmentareaSetter) SetColumns() []string {
|
||||
vals := make([]string, 0, 18)
|
||||
vals := make([]string, 0, 19)
|
||||
if s.Objectid.IsValue() {
|
||||
vals = append(vals, "objectid")
|
||||
}
|
||||
|
|
@ -192,6 +197,9 @@ func (s FieldseekerTreatmentareaSetter) SetColumns() []string {
|
|||
if !s.ShapeLength.IsUnset() {
|
||||
vals = append(vals, "shape__length")
|
||||
}
|
||||
if s.Version.IsValue() {
|
||||
vals = append(vals, "version")
|
||||
}
|
||||
return vals
|
||||
}
|
||||
|
||||
|
|
@ -250,6 +258,9 @@ func (s FieldseekerTreatmentareaSetter) Overwrite(t *FieldseekerTreatmentarea) {
|
|||
if !s.ShapeLength.IsUnset() {
|
||||
t.ShapeLength = s.ShapeLength.MustGetNull()
|
||||
}
|
||||
if s.Version.IsValue() {
|
||||
t.Version = s.Version.MustGet()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *FieldseekerTreatmentareaSetter) Apply(q *dialect.InsertQuery) {
|
||||
|
|
@ -258,7 +269,7 @@ func (s *FieldseekerTreatmentareaSetter) 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, 18)
|
||||
vals := make([]bob.Expression, 19)
|
||||
if s.Objectid.IsValue() {
|
||||
vals[0] = psql.Arg(s.Objectid.MustGet())
|
||||
} else {
|
||||
|
|
@ -367,6 +378,12 @@ func (s *FieldseekerTreatmentareaSetter) Apply(q *dialect.InsertQuery) {
|
|||
vals[17] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
if s.Version.IsValue() {
|
||||
vals[18] = psql.Arg(s.Version.MustGet())
|
||||
} else {
|
||||
vals[18] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "")
|
||||
}))
|
||||
}
|
||||
|
|
@ -376,7 +393,7 @@ func (s FieldseekerTreatmentareaSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery
|
|||
}
|
||||
|
||||
func (s FieldseekerTreatmentareaSetter) Expressions(prefix ...string) []bob.Expression {
|
||||
exprs := make([]bob.Expression, 0, 18)
|
||||
exprs := make([]bob.Expression, 0, 19)
|
||||
|
||||
if s.Objectid.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
|
|
@ -504,28 +521,38 @@ func (s FieldseekerTreatmentareaSetter) Expressions(prefix ...string) []bob.Expr
|
|||
}})
|
||||
}
|
||||
|
||||
if s.Version.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "version")...),
|
||||
psql.Arg(s.Version),
|
||||
}})
|
||||
}
|
||||
|
||||
return exprs
|
||||
}
|
||||
|
||||
// FindFieldseekerTreatmentarea retrieves a single record by primary key
|
||||
// If cols is empty Find will return all columns.
|
||||
func FindFieldseekerTreatmentarea(ctx context.Context, exec bob.Executor, ObjectidPK int64, cols ...string) (*FieldseekerTreatmentarea, error) {
|
||||
func FindFieldseekerTreatmentarea(ctx context.Context, exec bob.Executor, ObjectidPK int64, VersionPK int32, cols ...string) (*FieldseekerTreatmentarea, error) {
|
||||
if len(cols) == 0 {
|
||||
return FieldseekerTreatmentareas.Query(
|
||||
sm.Where(FieldseekerTreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
|
||||
sm.Where(FieldseekerTreatmentareas.Columns.Version.EQ(psql.Arg(VersionPK))),
|
||||
).One(ctx, exec)
|
||||
}
|
||||
|
||||
return FieldseekerTreatmentareas.Query(
|
||||
sm.Where(FieldseekerTreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
|
||||
sm.Where(FieldseekerTreatmentareas.Columns.Version.EQ(psql.Arg(VersionPK))),
|
||||
sm.Columns(FieldseekerTreatmentareas.Columns.Only(cols...)),
|
||||
).One(ctx, exec)
|
||||
}
|
||||
|
||||
// FieldseekerTreatmentareaExists checks the presence of a single record by primary key
|
||||
func FieldseekerTreatmentareaExists(ctx context.Context, exec bob.Executor, ObjectidPK int64) (bool, error) {
|
||||
func FieldseekerTreatmentareaExists(ctx context.Context, exec bob.Executor, ObjectidPK int64, VersionPK int32) (bool, error) {
|
||||
return FieldseekerTreatmentareas.Query(
|
||||
sm.Where(FieldseekerTreatmentareas.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
|
||||
sm.Where(FieldseekerTreatmentareas.Columns.Version.EQ(psql.Arg(VersionPK))),
|
||||
).Exists(ctx, exec)
|
||||
}
|
||||
|
||||
|
|
@ -549,11 +576,14 @@ func (o *FieldseekerTreatmentarea) AfterQueryHook(ctx context.Context, exec bob.
|
|||
|
||||
// primaryKeyVals returns the primary key values of the FieldseekerTreatmentarea
|
||||
func (o *FieldseekerTreatmentarea) primaryKeyVals() bob.Expression {
|
||||
return psql.Arg(o.Objectid)
|
||||
return psql.ArgGroup(
|
||||
o.Objectid,
|
||||
o.Version,
|
||||
)
|
||||
}
|
||||
|
||||
func (o *FieldseekerTreatmentarea) pkEQ() dialect.Expression {
|
||||
return psql.Quote("fieldseeker.treatmentarea", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
||||
return psql.Group(psql.Quote("fieldseeker.treatmentarea", "objectid"), psql.Quote("fieldseeker.treatmentarea", "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)
|
||||
}))
|
||||
}
|
||||
|
|
@ -580,6 +610,7 @@ func (o *FieldseekerTreatmentarea) Delete(ctx context.Context, exec bob.Executor
|
|||
func (o *FieldseekerTreatmentarea) Reload(ctx context.Context, exec bob.Executor) error {
|
||||
o2, err := FieldseekerTreatmentareas.Query(
|
||||
sm.Where(FieldseekerTreatmentareas.Columns.Objectid.EQ(psql.Arg(o.Objectid))),
|
||||
sm.Where(FieldseekerTreatmentareas.Columns.Version.EQ(psql.Arg(o.Version))),
|
||||
).One(ctx, exec)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -613,7 +644,7 @@ func (o FieldseekerTreatmentareaSlice) pkIN() dialect.Expression {
|
|||
return psql.Raw("NULL")
|
||||
}
|
||||
|
||||
return psql.Quote("fieldseeker.treatmentarea", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
||||
return psql.Group(psql.Quote("fieldseeker.treatmentarea", "objectid"), psql.Quote("fieldseeker.treatmentarea", "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()
|
||||
|
|
@ -631,6 +662,9 @@ func (o FieldseekerTreatmentareaSlice) copyMatchingRows(from ...*FieldseekerTrea
|
|||
if new.Objectid != old.Objectid {
|
||||
continue
|
||||
}
|
||||
if new.Version != old.Version {
|
||||
continue
|
||||
}
|
||||
|
||||
o[i] = new
|
||||
break
|
||||
|
|
@ -748,6 +782,7 @@ type fieldseekerTreatmentareaWhere[Q psql.Filterable] struct {
|
|||
Editor psql.WhereNullMod[Q, string]
|
||||
ShapeArea psql.WhereNullMod[Q, float64]
|
||||
ShapeLength psql.WhereNullMod[Q, float64]
|
||||
Version psql.WhereMod[Q, int32]
|
||||
}
|
||||
|
||||
func (fieldseekerTreatmentareaWhere[Q]) AliasedAs(alias string) fieldseekerTreatmentareaWhere[Q] {
|
||||
|
|
@ -774,5 +809,6 @@ func buildFieldseekerTreatmentareaWhere[Q psql.Filterable](cols fieldseekerTreat
|
|||
Editor: psql.WhereNull[Q, string](cols.Editor),
|
||||
ShapeArea: psql.WhereNull[Q, float64](cols.ShapeArea),
|
||||
ShapeLength: psql.WhereNull[Q, float64](cols.ShapeLength),
|
||||
Version: psql.Where[Q, int32](cols.Version),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue