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
|
||||
|
|
@ -41,6 +41,8 @@ type FieldseekerPooldetail 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" `
|
||||
}
|
||||
|
||||
// FieldseekerPooldetailSlice is an alias for a slice of pointers to FieldseekerPooldetail.
|
||||
|
|
@ -56,7 +58,7 @@ type FieldseekerPooldetailsQuery = *psql.ViewQuery[*FieldseekerPooldetail, Field
|
|||
func buildFieldseekerPooldetailColumns(alias string) fieldseekerPooldetailColumns {
|
||||
return fieldseekerPooldetailColumns{
|
||||
ColumnsExpr: expr.NewColumnsExpr(
|
||||
"objectid", "trapdata_id", "pool_id", "species", "females", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "creationdate", "creator", "editdate", "editor",
|
||||
"objectid", "trapdata_id", "pool_id", "species", "females", "globalid", "created_user", "created_date", "last_edited_user", "last_edited_date", "creationdate", "creator", "editdate", "editor", "version",
|
||||
).WithParent("fieldseeker.pooldetail"),
|
||||
tableAlias: alias,
|
||||
Objectid: psql.Quote(alias, "objectid"),
|
||||
|
|
@ -73,6 +75,7 @@ func buildFieldseekerPooldetailColumns(alias string) fieldseekerPooldetailColumn
|
|||
Creator: psql.Quote(alias, "creator"),
|
||||
Editdate: psql.Quote(alias, "editdate"),
|
||||
Editor: psql.Quote(alias, "editor"),
|
||||
Version: psql.Quote(alias, "version"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -93,6 +96,7 @@ type fieldseekerPooldetailColumns struct {
|
|||
Creator psql.Expression
|
||||
Editdate psql.Expression
|
||||
Editor psql.Expression
|
||||
Version psql.Expression
|
||||
}
|
||||
|
||||
func (c fieldseekerPooldetailColumns) Alias() string {
|
||||
|
|
@ -121,10 +125,11 @@ type FieldseekerPooldetailSetter 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 FieldseekerPooldetailSetter) SetColumns() []string {
|
||||
vals := make([]string, 0, 14)
|
||||
vals := make([]string, 0, 15)
|
||||
if s.Objectid.IsValue() {
|
||||
vals = append(vals, "objectid")
|
||||
}
|
||||
|
|
@ -167,6 +172,9 @@ func (s FieldseekerPooldetailSetter) SetColumns() []string {
|
|||
if !s.Editor.IsUnset() {
|
||||
vals = append(vals, "editor")
|
||||
}
|
||||
if s.Version.IsValue() {
|
||||
vals = append(vals, "version")
|
||||
}
|
||||
return vals
|
||||
}
|
||||
|
||||
|
|
@ -213,6 +221,9 @@ func (s FieldseekerPooldetailSetter) Overwrite(t *FieldseekerPooldetail) {
|
|||
if !s.Editor.IsUnset() {
|
||||
t.Editor = s.Editor.MustGetNull()
|
||||
}
|
||||
if s.Version.IsValue() {
|
||||
t.Version = s.Version.MustGet()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *FieldseekerPooldetailSetter) Apply(q *dialect.InsertQuery) {
|
||||
|
|
@ -221,7 +232,7 @@ func (s *FieldseekerPooldetailSetter) 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 {
|
||||
|
|
@ -306,6 +317,12 @@ func (s *FieldseekerPooldetailSetter) 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, "", ", ", "")
|
||||
}))
|
||||
}
|
||||
|
|
@ -315,7 +332,7 @@ func (s FieldseekerPooldetailSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] {
|
|||
}
|
||||
|
||||
func (s FieldseekerPooldetailSetter) 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{
|
||||
|
|
@ -415,28 +432,38 @@ func (s FieldseekerPooldetailSetter) Expressions(prefix ...string) []bob.Express
|
|||
}})
|
||||
}
|
||||
|
||||
if s.Version.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "version")...),
|
||||
psql.Arg(s.Version),
|
||||
}})
|
||||
}
|
||||
|
||||
return exprs
|
||||
}
|
||||
|
||||
// FindFieldseekerPooldetail retrieves a single record by primary key
|
||||
// If cols is empty Find will return all columns.
|
||||
func FindFieldseekerPooldetail(ctx context.Context, exec bob.Executor, ObjectidPK int64, cols ...string) (*FieldseekerPooldetail, error) {
|
||||
func FindFieldseekerPooldetail(ctx context.Context, exec bob.Executor, ObjectidPK int64, VersionPK int32, cols ...string) (*FieldseekerPooldetail, error) {
|
||||
if len(cols) == 0 {
|
||||
return FieldseekerPooldetails.Query(
|
||||
sm.Where(FieldseekerPooldetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
|
||||
sm.Where(FieldseekerPooldetails.Columns.Version.EQ(psql.Arg(VersionPK))),
|
||||
).One(ctx, exec)
|
||||
}
|
||||
|
||||
return FieldseekerPooldetails.Query(
|
||||
sm.Where(FieldseekerPooldetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
|
||||
sm.Where(FieldseekerPooldetails.Columns.Version.EQ(psql.Arg(VersionPK))),
|
||||
sm.Columns(FieldseekerPooldetails.Columns.Only(cols...)),
|
||||
).One(ctx, exec)
|
||||
}
|
||||
|
||||
// FieldseekerPooldetailExists checks the presence of a single record by primary key
|
||||
func FieldseekerPooldetailExists(ctx context.Context, exec bob.Executor, ObjectidPK int64) (bool, error) {
|
||||
func FieldseekerPooldetailExists(ctx context.Context, exec bob.Executor, ObjectidPK int64, VersionPK int32) (bool, error) {
|
||||
return FieldseekerPooldetails.Query(
|
||||
sm.Where(FieldseekerPooldetails.Columns.Objectid.EQ(psql.Arg(ObjectidPK))),
|
||||
sm.Where(FieldseekerPooldetails.Columns.Version.EQ(psql.Arg(VersionPK))),
|
||||
).Exists(ctx, exec)
|
||||
}
|
||||
|
||||
|
|
@ -460,11 +487,14 @@ func (o *FieldseekerPooldetail) AfterQueryHook(ctx context.Context, exec bob.Exe
|
|||
|
||||
// primaryKeyVals returns the primary key values of the FieldseekerPooldetail
|
||||
func (o *FieldseekerPooldetail) primaryKeyVals() bob.Expression {
|
||||
return psql.Arg(o.Objectid)
|
||||
return psql.ArgGroup(
|
||||
o.Objectid,
|
||||
o.Version,
|
||||
)
|
||||
}
|
||||
|
||||
func (o *FieldseekerPooldetail) pkEQ() dialect.Expression {
|
||||
return psql.Quote("fieldseeker.pooldetail", "objectid").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
||||
return psql.Group(psql.Quote("fieldseeker.pooldetail", "objectid"), psql.Quote("fieldseeker.pooldetail", "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)
|
||||
}))
|
||||
}
|
||||
|
|
@ -491,6 +521,7 @@ func (o *FieldseekerPooldetail) Delete(ctx context.Context, exec bob.Executor) e
|
|||
func (o *FieldseekerPooldetail) Reload(ctx context.Context, exec bob.Executor) error {
|
||||
o2, err := FieldseekerPooldetails.Query(
|
||||
sm.Where(FieldseekerPooldetails.Columns.Objectid.EQ(psql.Arg(o.Objectid))),
|
||||
sm.Where(FieldseekerPooldetails.Columns.Version.EQ(psql.Arg(o.Version))),
|
||||
).One(ctx, exec)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -524,7 +555,7 @@ func (o FieldseekerPooldetailSlice) pkIN() dialect.Expression {
|
|||
return psql.Raw("NULL")
|
||||
}
|
||||
|
||||
return psql.Quote("fieldseeker.pooldetail", "objectid").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
||||
return psql.Group(psql.Quote("fieldseeker.pooldetail", "objectid"), psql.Quote("fieldseeker.pooldetail", "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()
|
||||
|
|
@ -542,6 +573,9 @@ func (o FieldseekerPooldetailSlice) copyMatchingRows(from ...*FieldseekerPooldet
|
|||
if new.Objectid != old.Objectid {
|
||||
continue
|
||||
}
|
||||
if new.Version != old.Version {
|
||||
continue
|
||||
}
|
||||
|
||||
o[i] = new
|
||||
break
|
||||
|
|
@ -655,6 +689,7 @@ type fieldseekerPooldetailWhere[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 (fieldseekerPooldetailWhere[Q]) AliasedAs(alias string) fieldseekerPooldetailWhere[Q] {
|
||||
|
|
@ -677,5 +712,6 @@ func buildFieldseekerPooldetailWhere[Q psql.Filterable](cols fieldseekerPooldeta
|
|||
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