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
|
||||
|
|
@ -39,6 +39,8 @@ type FieldseekerContainerrelate 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" `
|
||||
}
|
||||
|
||||
// FieldseekerContainerrelateSlice is an alias for a slice of pointers to FieldseekerContainerrelate.
|
||||
|
|
@ -54,7 +56,7 @@ type FieldseekerContainerrelatesQuery = *psql.ViewQuery[*FieldseekerContainerrel
|
|||
func buildFieldseekerContainerrelateColumns(alias string) fieldseekerContainerrelateColumns {
|
||||
return fieldseekerContainerrelateColumns{
|
||||
ColumnsExpr: expr.NewColumnsExpr(
|
||||
"objectid", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "inspsampleid", "mosquitoinspid", "treatmentid", "containertype", "creationdate", "creator", "editdate", "editor",
|
||||
"objectid", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "inspsampleid", "mosquitoinspid", "treatmentid", "containertype", "creationdate", "creator", "editdate", "editor", "version",
|
||||
).WithParent("fieldseeker.containerrelate"),
|
||||
tableAlias: alias,
|
||||
Objectid: psql.Quote(alias, "objectid"),
|
||||
|
|
@ -71,6 +73,7 @@ func buildFieldseekerContainerrelateColumns(alias string) fieldseekerContainerre
|
|||
Creator: psql.Quote(alias, "creator"),
|
||||
Editdate: psql.Quote(alias, "editdate"),
|
||||
Editor: psql.Quote(alias, "editor"),
|
||||
Version: psql.Quote(alias, "version"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -91,6 +94,7 @@ type fieldseekerContainerrelateColumns struct {
|
|||
Creator psql.Expression
|
||||
Editdate psql.Expression
|
||||
Editor psql.Expression
|
||||
Version psql.Expression
|
||||
}
|
||||
|
||||
func (c fieldseekerContainerrelateColumns) Alias() string {
|
||||
|
|
@ -119,10 +123,11 @@ type FieldseekerContainerrelateSetter 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 FieldseekerContainerrelateSetter) SetColumns() []string {
|
||||
vals := make([]string, 0, 14)
|
||||
vals := make([]string, 0, 15)
|
||||
if s.Objectid.IsValue() {
|
||||
vals = append(vals, "objectid")
|
||||
}
|
||||
|
|
@ -165,6 +170,9 @@ func (s FieldseekerContainerrelateSetter) SetColumns() []string {
|
|||
if !s.Editor.IsUnset() {
|
||||
vals = append(vals, "editor")
|
||||
}
|
||||
if s.Version.IsValue() {
|
||||
vals = append(vals, "version")
|
||||
}
|
||||
return vals
|
||||
}
|
||||
|
||||
|
|
@ -211,6 +219,9 @@ func (s FieldseekerContainerrelateSetter) Overwrite(t *FieldseekerContainerrelat
|
|||
if !s.Editor.IsUnset() {
|
||||
t.Editor = s.Editor.MustGetNull()
|
||||
}
|
||||
if s.Version.IsValue() {
|
||||
t.Version = s.Version.MustGet()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *FieldseekerContainerrelateSetter) Apply(q *dialect.InsertQuery) {
|
||||
|
|
@ -219,7 +230,7 @@ func (s *FieldseekerContainerrelateSetter) 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, 14)
|
||||
vals := make([]bob.Expression, 15)
|
||||
if s.Objectid.IsValue() {
|
||||
vals[0] = psql.Arg(s.Objectid.MustGet())
|
||||
} else {
|
||||
|
|
@ -304,6 +315,12 @@ func (s *FieldseekerContainerrelateSetter) Apply(q *dialect.InsertQuery) {
|
|||
vals[13] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
if s.Version.IsValue() {
|
||||
vals[14] = psql.Arg(s.Version.MustGet())
|
||||
} else {
|
||||
vals[14] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "")
|
||||
}))
|
||||
}
|
||||
|
|
@ -313,7 +330,7 @@ func (s FieldseekerContainerrelateSetter) UpdateMod() bob.Mod[*dialect.UpdateQue
|
|||
}
|
||||
|
||||
func (s FieldseekerContainerrelateSetter) Expressions(prefix ...string) []bob.Expression {
|
||||
exprs := make([]bob.Expression, 0, 14)
|
||||
exprs := make([]bob.Expression, 0, 15)
|
||||
|
||||
if s.Objectid.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
|
|
@ -413,28 +430,38 @@ func (s FieldseekerContainerrelateSetter) 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
|
||||
}
|
||||
|
||||
// FindFieldseekerContainerrelate retrieves a single record by primary key
|
||||
// If cols is empty Find will return all columns.
|
||||
func FindFieldseekerContainerrelate(ctx context.Context, exec bob.Executor, ObjectidPK int64, cols ...string) (*FieldseekerContainerrelate, error) {
|
||||
func FindFieldseekerContainerrelate(ctx context.Context, exec bob.Executor, ObjectidPK int64, VersionPK int32, cols ...string) (*FieldseekerContainerrelate, error) {
|
||||
if len(cols) == 0 {
|
||||
return FieldseekerContainerrelates.Query(
|
||||
sm.Where(FieldseekerContainerrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
|
||||
sm.Where(FieldseekerContainerrelates.Columns.Version.EQ(psql.Arg(VersionPK))),
|
||||
).One(ctx, exec)
|
||||
}
|
||||
|
||||
return FieldseekerContainerrelates.Query(
|
||||
sm.Where(FieldseekerContainerrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
|
||||
sm.Where(FieldseekerContainerrelates.Columns.Version.EQ(psql.Arg(VersionPK))),
|
||||
sm.Columns(FieldseekerContainerrelates.Columns.Only(cols...)),
|
||||
).One(ctx, exec)
|
||||
}
|
||||
|
||||
// FieldseekerContainerrelateExists checks the presence of a single record by primary key
|
||||
func FieldseekerContainerrelateExists(ctx context.Context, exec bob.Executor, ObjectidPK int64) (bool, error) {
|
||||
func FieldseekerContainerrelateExists(ctx context.Context, exec bob.Executor, ObjectidPK int64, VersionPK int32) (bool, error) {
|
||||
return FieldseekerContainerrelates.Query(
|
||||
sm.Where(FieldseekerContainerrelates.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
|
||||
sm.Where(FieldseekerContainerrelates.Columns.Version.EQ(psql.Arg(VersionPK))),
|
||||
).Exists(ctx, exec)
|
||||
}
|
||||
|
||||
|
|
@ -458,11 +485,14 @@ func (o *FieldseekerContainerrelate) AfterQueryHook(ctx context.Context, exec bo
|
|||
|
||||
// primaryKeyVals returns the primary key values of the FieldseekerContainerrelate
|
||||
func (o *FieldseekerContainerrelate) primaryKeyVals() bob.Expression {
|
||||
return psql.Arg(o.Objectid)
|
||||
return psql.ArgGroup(
|
||||
o.Objectid,
|
||||
o.Version,
|
||||
)
|
||||
}
|
||||
|
||||
func (o *FieldseekerContainerrelate) pkEQ() dialect.Expression {
|
||||
return psql.Quote("fieldseeker.containerrelate", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
||||
return psql.Group(psql.Quote("fieldseeker.containerrelate", "objectid"), psql.Quote("fieldseeker.containerrelate", "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)
|
||||
}))
|
||||
}
|
||||
|
|
@ -489,6 +519,7 @@ func (o *FieldseekerContainerrelate) Delete(ctx context.Context, exec bob.Execut
|
|||
func (o *FieldseekerContainerrelate) Reload(ctx context.Context, exec bob.Executor) error {
|
||||
o2, err := FieldseekerContainerrelates.Query(
|
||||
sm.Where(FieldseekerContainerrelates.Columns.Objectid.EQ(psql.Arg(o.Objectid))),
|
||||
sm.Where(FieldseekerContainerrelates.Columns.Version.EQ(psql.Arg(o.Version))),
|
||||
).One(ctx, exec)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -522,7 +553,7 @@ func (o FieldseekerContainerrelateSlice) pkIN() dialect.Expression {
|
|||
return psql.Raw("NULL")
|
||||
}
|
||||
|
||||
return psql.Quote("fieldseeker.containerrelate", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
||||
return psql.Group(psql.Quote("fieldseeker.containerrelate", "objectid"), psql.Quote("fieldseeker.containerrelate", "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()
|
||||
|
|
@ -540,6 +571,9 @@ func (o FieldseekerContainerrelateSlice) copyMatchingRows(from ...*FieldseekerCo
|
|||
if new.Objectid != old.Objectid {
|
||||
continue
|
||||
}
|
||||
if new.Version != old.Version {
|
||||
continue
|
||||
}
|
||||
|
||||
o[i] = new
|
||||
break
|
||||
|
|
@ -653,6 +687,7 @@ type fieldseekerContainerrelateWhere[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 (fieldseekerContainerrelateWhere[Q]) AliasedAs(alias string) fieldseekerContainerrelateWhere[Q] {
|
||||
|
|
@ -675,5 +710,6 @@ func buildFieldseekerContainerrelateWhere[Q psql.Filterable](cols fieldseekerCon
|
|||
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),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue