Add resolution for tracking review_task discards
This commit is contained in:
parent
3ccc05d4c5
commit
10b4bf929f
9 changed files with 210 additions and 50 deletions
|
|
@ -69,8 +69,8 @@ var Features = Table[
|
|||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Geometry: column{
|
||||
Name: "geometry",
|
||||
Location: column{
|
||||
Name: "location",
|
||||
DBType: "geometry",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
|
|
@ -143,12 +143,12 @@ type featureColumns struct {
|
|||
OrganizationID column
|
||||
SiteID column
|
||||
SiteVersion column
|
||||
Geometry column
|
||||
Location column
|
||||
}
|
||||
|
||||
func (c featureColumns) AsSlice() []column {
|
||||
return []column{
|
||||
c.Created, c.CreatorID, c.ID, c.OrganizationID, c.SiteID, c.SiteVersion, c.Geometry,
|
||||
c.Created, c.CreatorID, c.ID, c.OrganizationID, c.SiteID, c.SiteVersion, c.Location,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,6 +69,15 @@ var ReviewTasks = Table[
|
|||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Resolution: column{
|
||||
Name: "resolution",
|
||||
DBType: "public.reviewtaskresolutiontype",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
},
|
||||
Indexes: reviewTaskIndexes{
|
||||
ReviewTaskPkey: index{
|
||||
|
|
@ -134,11 +143,12 @@ type reviewTaskColumns struct {
|
|||
OrganizationID column
|
||||
Reviewed column
|
||||
ReviewerID column
|
||||
Resolution column
|
||||
}
|
||||
|
||||
func (c reviewTaskColumns) AsSlice() []column {
|
||||
return []column{
|
||||
c.Created, c.CreatorID, c.ID, c.OrganizationID, c.Reviewed, c.ReviewerID,
|
||||
c.Created, c.CreatorID, c.ID, c.OrganizationID, c.Reviewed, c.ReviewerID, c.Resolution,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,15 @@ var ReviewTaskPools = Table[
|
|||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Condition: column{
|
||||
Name: "condition",
|
||||
DBType: "public.poolconditiontype",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
},
|
||||
Indexes: reviewTaskPoolIndexes{
|
||||
ReviewTaskPoolPkey: index{
|
||||
|
|
@ -105,11 +114,12 @@ type reviewTaskPoolColumns struct {
|
|||
Location column
|
||||
Geometry column
|
||||
ReviewTaskID column
|
||||
Condition column
|
||||
}
|
||||
|
||||
func (c reviewTaskPoolColumns) AsSlice() []column {
|
||||
return []column{
|
||||
c.FeaturePoolID, c.Location, c.Geometry, c.ReviewTaskID,
|
||||
c.FeaturePoolID, c.Location, c.Geometry, c.ReviewTaskID, c.Condition,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1945,6 +1945,79 @@ func (e *PublicreportReportstatustype) Scan(value any) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Enum values for Reviewtaskresolutiontype
|
||||
const (
|
||||
ReviewtaskresolutiontypeCommitted Reviewtaskresolutiontype = "committed"
|
||||
ReviewtaskresolutiontypeDiscarded Reviewtaskresolutiontype = "discarded"
|
||||
)
|
||||
|
||||
func AllReviewtaskresolutiontype() []Reviewtaskresolutiontype {
|
||||
return []Reviewtaskresolutiontype{
|
||||
ReviewtaskresolutiontypeCommitted,
|
||||
ReviewtaskresolutiontypeDiscarded,
|
||||
}
|
||||
}
|
||||
|
||||
type Reviewtaskresolutiontype string
|
||||
|
||||
func (e Reviewtaskresolutiontype) String() string {
|
||||
return string(e)
|
||||
}
|
||||
|
||||
func (e Reviewtaskresolutiontype) Valid() bool {
|
||||
switch e {
|
||||
case ReviewtaskresolutiontypeCommitted,
|
||||
ReviewtaskresolutiontypeDiscarded:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// useful when testing in other packages
|
||||
func (e Reviewtaskresolutiontype) All() []Reviewtaskresolutiontype {
|
||||
return AllReviewtaskresolutiontype()
|
||||
}
|
||||
|
||||
func (e Reviewtaskresolutiontype) MarshalText() ([]byte, error) {
|
||||
return []byte(e), nil
|
||||
}
|
||||
|
||||
func (e *Reviewtaskresolutiontype) UnmarshalText(text []byte) error {
|
||||
return e.Scan(text)
|
||||
}
|
||||
|
||||
func (e Reviewtaskresolutiontype) MarshalBinary() ([]byte, error) {
|
||||
return []byte(e), nil
|
||||
}
|
||||
|
||||
func (e *Reviewtaskresolutiontype) UnmarshalBinary(data []byte) error {
|
||||
return e.Scan(data)
|
||||
}
|
||||
|
||||
func (e Reviewtaskresolutiontype) Value() (driver.Value, error) {
|
||||
return string(e), nil
|
||||
}
|
||||
|
||||
func (e *Reviewtaskresolutiontype) Scan(value any) error {
|
||||
switch x := value.(type) {
|
||||
case string:
|
||||
*e = Reviewtaskresolutiontype(x)
|
||||
case []byte:
|
||||
*e = Reviewtaskresolutiontype(x)
|
||||
case nil:
|
||||
return fmt.Errorf("cannot nil into Reviewtaskresolutiontype")
|
||||
default:
|
||||
return fmt.Errorf("cannot scan type %T: %v", value, value)
|
||||
}
|
||||
|
||||
if !e.Valid() {
|
||||
return fmt.Errorf("invalid Reviewtaskresolutiontype value: %s", *e)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Enum values for Signaltype
|
||||
const (
|
||||
SignaltypeFlyoverPool Signaltype = "flyover pool"
|
||||
|
|
|
|||
11
db/migrations/00101_review_task_pool_condition.sql
Normal file
11
db/migrations/00101_review_task_pool_condition.sql
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
-- +goose Up
|
||||
ALTER TABLE review_task_pool ADD COLUMN condition PoolConditionType;
|
||||
CREATE TYPE ReviewTaskResolutionType AS ENUM (
|
||||
'committed',
|
||||
'discarded'
|
||||
);
|
||||
ALTER TABLE review_task ADD COLUMN resolution ReviewTaskResolutionType;
|
||||
-- +goose Down
|
||||
ALTER TABLE review_task DROP COLUMN resolution;
|
||||
DROP TYPE ReviewTaskResolutionType
|
||||
ALTER TABLE review_task_pool DROP COLUMN condition;
|
||||
4
db/migrations/00102_feature_location.sql
Normal file
4
db/migrations/00102_feature_location.sql
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
-- +goose Up
|
||||
ALTER TABLE feature RENAME COLUMN geometry TO location;
|
||||
-- +goose Down
|
||||
ALTER TABLE feature RENAME COLUMN location TO geometry;
|
||||
|
|
@ -31,7 +31,7 @@ type Feature struct {
|
|||
OrganizationID int32 `db:"organization_id" `
|
||||
SiteID int32 `db:"site_id" `
|
||||
SiteVersion int32 `db:"site_version" `
|
||||
Geometry null.Val[string] `db:"geometry" `
|
||||
Location null.Val[string] `db:"location" `
|
||||
|
||||
R featureR `db:"-" `
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ type featureR struct {
|
|||
func buildFeatureColumns(alias string) featureColumns {
|
||||
return featureColumns{
|
||||
ColumnsExpr: expr.NewColumnsExpr(
|
||||
"created", "creator_id", "id", "organization_id", "site_id", "site_version", "geometry",
|
||||
"created", "creator_id", "id", "organization_id", "site_id", "site_version", "location",
|
||||
).WithParent("feature"),
|
||||
tableAlias: alias,
|
||||
Created: psql.Quote(alias, "created"),
|
||||
|
|
@ -66,7 +66,7 @@ func buildFeatureColumns(alias string) featureColumns {
|
|||
OrganizationID: psql.Quote(alias, "organization_id"),
|
||||
SiteID: psql.Quote(alias, "site_id"),
|
||||
SiteVersion: psql.Quote(alias, "site_version"),
|
||||
Geometry: psql.Quote(alias, "geometry"),
|
||||
Location: psql.Quote(alias, "location"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ type featureColumns struct {
|
|||
OrganizationID psql.Expression
|
||||
SiteID psql.Expression
|
||||
SiteVersion psql.Expression
|
||||
Geometry psql.Expression
|
||||
Location psql.Expression
|
||||
}
|
||||
|
||||
func (c featureColumns) Alias() string {
|
||||
|
|
@ -100,7 +100,7 @@ type FeatureSetter struct {
|
|||
OrganizationID omit.Val[int32] `db:"organization_id" `
|
||||
SiteID omit.Val[int32] `db:"site_id" `
|
||||
SiteVersion omit.Val[int32] `db:"site_version" `
|
||||
Geometry omitnull.Val[string] `db:"geometry" `
|
||||
Location omitnull.Val[string] `db:"location" `
|
||||
}
|
||||
|
||||
func (s FeatureSetter) SetColumns() []string {
|
||||
|
|
@ -123,8 +123,8 @@ func (s FeatureSetter) SetColumns() []string {
|
|||
if s.SiteVersion.IsValue() {
|
||||
vals = append(vals, "site_version")
|
||||
}
|
||||
if !s.Geometry.IsUnset() {
|
||||
vals = append(vals, "geometry")
|
||||
if !s.Location.IsUnset() {
|
||||
vals = append(vals, "location")
|
||||
}
|
||||
return vals
|
||||
}
|
||||
|
|
@ -148,8 +148,8 @@ func (s FeatureSetter) Overwrite(t *Feature) {
|
|||
if s.SiteVersion.IsValue() {
|
||||
t.SiteVersion = s.SiteVersion.MustGet()
|
||||
}
|
||||
if !s.Geometry.IsUnset() {
|
||||
t.Geometry = s.Geometry.MustGetNull()
|
||||
if !s.Location.IsUnset() {
|
||||
t.Location = s.Location.MustGetNull()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -196,8 +196,8 @@ func (s *FeatureSetter) Apply(q *dialect.InsertQuery) {
|
|||
vals[5] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
if !s.Geometry.IsUnset() {
|
||||
vals[6] = psql.Arg(s.Geometry.MustGetNull())
|
||||
if !s.Location.IsUnset() {
|
||||
vals[6] = psql.Arg(s.Location.MustGetNull())
|
||||
} else {
|
||||
vals[6] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
|
@ -255,10 +255,10 @@ func (s FeatureSetter) Expressions(prefix ...string) []bob.Expression {
|
|||
}})
|
||||
}
|
||||
|
||||
if !s.Geometry.IsUnset() {
|
||||
if !s.Location.IsUnset() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "geometry")...),
|
||||
psql.Arg(s.Geometry),
|
||||
psql.Quote(append(prefix, "location")...),
|
||||
psql.Arg(s.Location),
|
||||
}})
|
||||
}
|
||||
|
||||
|
|
@ -794,7 +794,7 @@ type featureWhere[Q psql.Filterable] struct {
|
|||
OrganizationID psql.WhereMod[Q, int32]
|
||||
SiteID psql.WhereMod[Q, int32]
|
||||
SiteVersion psql.WhereMod[Q, int32]
|
||||
Geometry psql.WhereNullMod[Q, string]
|
||||
Location psql.WhereNullMod[Q, string]
|
||||
}
|
||||
|
||||
func (featureWhere[Q]) AliasedAs(alias string) featureWhere[Q] {
|
||||
|
|
@ -809,7 +809,7 @@ func buildFeatureWhere[Q psql.Filterable](cols featureColumns) featureWhere[Q] {
|
|||
OrganizationID: psql.Where[Q, int32](cols.OrganizationID),
|
||||
SiteID: psql.Where[Q, int32](cols.SiteID),
|
||||
SiteVersion: psql.Where[Q, int32](cols.SiteVersion),
|
||||
Geometry: psql.WhereNull[Q, string](cols.Geometry),
|
||||
Location: psql.WhereNull[Q, string](cols.Location),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import (
|
|||
"github.com/Gleipnir-Technology/bob/expr"
|
||||
"github.com/Gleipnir-Technology/bob/orm"
|
||||
"github.com/Gleipnir-Technology/bob/types/pgtypes"
|
||||
enums "github.com/Gleipnir-Technology/nidus-sync/db/enums"
|
||||
"github.com/aarondl/opt/null"
|
||||
"github.com/aarondl/opt/omit"
|
||||
"github.com/aarondl/opt/omitnull"
|
||||
|
|
@ -31,6 +32,7 @@ type ReviewTask struct {
|
|||
OrganizationID int32 `db:"organization_id" `
|
||||
Reviewed null.Val[time.Time] `db:"reviewed" `
|
||||
ReviewerID null.Val[int32] `db:"reviewer_id" `
|
||||
Resolution null.Val[enums.Reviewtaskresolutiontype] `db:"resolution" `
|
||||
|
||||
R reviewTaskR `db:"-" `
|
||||
}
|
||||
|
|
@ -56,7 +58,7 @@ type reviewTaskR struct {
|
|||
func buildReviewTaskColumns(alias string) reviewTaskColumns {
|
||||
return reviewTaskColumns{
|
||||
ColumnsExpr: expr.NewColumnsExpr(
|
||||
"created", "creator_id", "id", "organization_id", "reviewed", "reviewer_id",
|
||||
"created", "creator_id", "id", "organization_id", "reviewed", "reviewer_id", "resolution",
|
||||
).WithParent("review_task"),
|
||||
tableAlias: alias,
|
||||
Created: psql.Quote(alias, "created"),
|
||||
|
|
@ -65,6 +67,7 @@ func buildReviewTaskColumns(alias string) reviewTaskColumns {
|
|||
OrganizationID: psql.Quote(alias, "organization_id"),
|
||||
Reviewed: psql.Quote(alias, "reviewed"),
|
||||
ReviewerID: psql.Quote(alias, "reviewer_id"),
|
||||
Resolution: psql.Quote(alias, "resolution"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -77,6 +80,7 @@ type reviewTaskColumns struct {
|
|||
OrganizationID psql.Expression
|
||||
Reviewed psql.Expression
|
||||
ReviewerID psql.Expression
|
||||
Resolution psql.Expression
|
||||
}
|
||||
|
||||
func (c reviewTaskColumns) Alias() string {
|
||||
|
|
@ -97,10 +101,11 @@ type ReviewTaskSetter struct {
|
|||
OrganizationID omit.Val[int32] `db:"organization_id" `
|
||||
Reviewed omitnull.Val[time.Time] `db:"reviewed" `
|
||||
ReviewerID omitnull.Val[int32] `db:"reviewer_id" `
|
||||
Resolution omitnull.Val[enums.Reviewtaskresolutiontype] `db:"resolution" `
|
||||
}
|
||||
|
||||
func (s ReviewTaskSetter) SetColumns() []string {
|
||||
vals := make([]string, 0, 6)
|
||||
vals := make([]string, 0, 7)
|
||||
if s.Created.IsValue() {
|
||||
vals = append(vals, "created")
|
||||
}
|
||||
|
|
@ -119,6 +124,9 @@ func (s ReviewTaskSetter) SetColumns() []string {
|
|||
if !s.ReviewerID.IsUnset() {
|
||||
vals = append(vals, "reviewer_id")
|
||||
}
|
||||
if !s.Resolution.IsUnset() {
|
||||
vals = append(vals, "resolution")
|
||||
}
|
||||
return vals
|
||||
}
|
||||
|
||||
|
|
@ -141,6 +149,9 @@ func (s ReviewTaskSetter) Overwrite(t *ReviewTask) {
|
|||
if !s.ReviewerID.IsUnset() {
|
||||
t.ReviewerID = s.ReviewerID.MustGetNull()
|
||||
}
|
||||
if !s.Resolution.IsUnset() {
|
||||
t.Resolution = s.Resolution.MustGetNull()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ReviewTaskSetter) Apply(q *dialect.InsertQuery) {
|
||||
|
|
@ -149,7 +160,7 @@ func (s *ReviewTaskSetter) 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, 6)
|
||||
vals := make([]bob.Expression, 7)
|
||||
if s.Created.IsValue() {
|
||||
vals[0] = psql.Arg(s.Created.MustGet())
|
||||
} else {
|
||||
|
|
@ -186,6 +197,12 @@ func (s *ReviewTaskSetter) Apply(q *dialect.InsertQuery) {
|
|||
vals[5] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
if !s.Resolution.IsUnset() {
|
||||
vals[6] = psql.Arg(s.Resolution.MustGetNull())
|
||||
} else {
|
||||
vals[6] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "")
|
||||
}))
|
||||
}
|
||||
|
|
@ -195,7 +212,7 @@ func (s ReviewTaskSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] {
|
|||
}
|
||||
|
||||
func (s ReviewTaskSetter) Expressions(prefix ...string) []bob.Expression {
|
||||
exprs := make([]bob.Expression, 0, 6)
|
||||
exprs := make([]bob.Expression, 0, 7)
|
||||
|
||||
if s.Created.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
|
|
@ -239,6 +256,13 @@ func (s ReviewTaskSetter) Expressions(prefix ...string) []bob.Expression {
|
|||
}})
|
||||
}
|
||||
|
||||
if !s.Resolution.IsUnset() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "resolution")...),
|
||||
psql.Arg(s.Resolution),
|
||||
}})
|
||||
}
|
||||
|
||||
return exprs
|
||||
}
|
||||
|
||||
|
|
@ -766,6 +790,7 @@ type reviewTaskWhere[Q psql.Filterable] struct {
|
|||
OrganizationID psql.WhereMod[Q, int32]
|
||||
Reviewed psql.WhereNullMod[Q, time.Time]
|
||||
ReviewerID psql.WhereNullMod[Q, int32]
|
||||
Resolution psql.WhereNullMod[Q, enums.Reviewtaskresolutiontype]
|
||||
}
|
||||
|
||||
func (reviewTaskWhere[Q]) AliasedAs(alias string) reviewTaskWhere[Q] {
|
||||
|
|
@ -780,6 +805,7 @@ func buildReviewTaskWhere[Q psql.Filterable](cols reviewTaskColumns) reviewTaskW
|
|||
OrganizationID: psql.Where[Q, int32](cols.OrganizationID),
|
||||
Reviewed: psql.WhereNull[Q, time.Time](cols.Reviewed),
|
||||
ReviewerID: psql.WhereNull[Q, int32](cols.ReviewerID),
|
||||
Resolution: psql.WhereNull[Q, enums.Reviewtaskresolutiontype](cols.Resolution),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import (
|
|||
"github.com/Gleipnir-Technology/bob/expr"
|
||||
"github.com/Gleipnir-Technology/bob/orm"
|
||||
"github.com/Gleipnir-Technology/bob/types/pgtypes"
|
||||
enums "github.com/Gleipnir-Technology/nidus-sync/db/enums"
|
||||
"github.com/aarondl/opt/null"
|
||||
"github.com/aarondl/opt/omit"
|
||||
"github.com/aarondl/opt/omitnull"
|
||||
|
|
@ -28,6 +29,7 @@ type ReviewTaskPool struct {
|
|||
Location null.Val[string] `db:"location" `
|
||||
Geometry null.Val[string] `db:"geometry" `
|
||||
ReviewTaskID int32 `db:"review_task_id,pk" `
|
||||
Condition null.Val[enums.Poolconditiontype] `db:"condition" `
|
||||
|
||||
R reviewTaskPoolR `db:"-" `
|
||||
}
|
||||
|
|
@ -51,13 +53,14 @@ type reviewTaskPoolR struct {
|
|||
func buildReviewTaskPoolColumns(alias string) reviewTaskPoolColumns {
|
||||
return reviewTaskPoolColumns{
|
||||
ColumnsExpr: expr.NewColumnsExpr(
|
||||
"feature_pool_id", "location", "geometry", "review_task_id",
|
||||
"feature_pool_id", "location", "geometry", "review_task_id", "condition",
|
||||
).WithParent("review_task_pool"),
|
||||
tableAlias: alias,
|
||||
FeaturePoolID: psql.Quote(alias, "feature_pool_id"),
|
||||
Location: psql.Quote(alias, "location"),
|
||||
Geometry: psql.Quote(alias, "geometry"),
|
||||
ReviewTaskID: psql.Quote(alias, "review_task_id"),
|
||||
Condition: psql.Quote(alias, "condition"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -68,6 +71,7 @@ type reviewTaskPoolColumns struct {
|
|||
Location psql.Expression
|
||||
Geometry psql.Expression
|
||||
ReviewTaskID psql.Expression
|
||||
Condition psql.Expression
|
||||
}
|
||||
|
||||
func (c reviewTaskPoolColumns) Alias() string {
|
||||
|
|
@ -86,10 +90,11 @@ type ReviewTaskPoolSetter struct {
|
|||
Location omitnull.Val[string] `db:"location" `
|
||||
Geometry omitnull.Val[string] `db:"geometry" `
|
||||
ReviewTaskID omit.Val[int32] `db:"review_task_id,pk" `
|
||||
Condition omitnull.Val[enums.Poolconditiontype] `db:"condition" `
|
||||
}
|
||||
|
||||
func (s ReviewTaskPoolSetter) SetColumns() []string {
|
||||
vals := make([]string, 0, 4)
|
||||
vals := make([]string, 0, 5)
|
||||
if s.FeaturePoolID.IsValue() {
|
||||
vals = append(vals, "feature_pool_id")
|
||||
}
|
||||
|
|
@ -102,6 +107,9 @@ func (s ReviewTaskPoolSetter) SetColumns() []string {
|
|||
if s.ReviewTaskID.IsValue() {
|
||||
vals = append(vals, "review_task_id")
|
||||
}
|
||||
if !s.Condition.IsUnset() {
|
||||
vals = append(vals, "condition")
|
||||
}
|
||||
return vals
|
||||
}
|
||||
|
||||
|
|
@ -118,6 +126,9 @@ func (s ReviewTaskPoolSetter) Overwrite(t *ReviewTaskPool) {
|
|||
if s.ReviewTaskID.IsValue() {
|
||||
t.ReviewTaskID = s.ReviewTaskID.MustGet()
|
||||
}
|
||||
if !s.Condition.IsUnset() {
|
||||
t.Condition = s.Condition.MustGetNull()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ReviewTaskPoolSetter) Apply(q *dialect.InsertQuery) {
|
||||
|
|
@ -126,7 +137,7 @@ func (s *ReviewTaskPoolSetter) 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, 4)
|
||||
vals := make([]bob.Expression, 5)
|
||||
if s.FeaturePoolID.IsValue() {
|
||||
vals[0] = psql.Arg(s.FeaturePoolID.MustGet())
|
||||
} else {
|
||||
|
|
@ -151,6 +162,12 @@ func (s *ReviewTaskPoolSetter) Apply(q *dialect.InsertQuery) {
|
|||
vals[3] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
if !s.Condition.IsUnset() {
|
||||
vals[4] = psql.Arg(s.Condition.MustGetNull())
|
||||
} else {
|
||||
vals[4] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "")
|
||||
}))
|
||||
}
|
||||
|
|
@ -160,7 +177,7 @@ func (s ReviewTaskPoolSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] {
|
|||
}
|
||||
|
||||
func (s ReviewTaskPoolSetter) Expressions(prefix ...string) []bob.Expression {
|
||||
exprs := make([]bob.Expression, 0, 4)
|
||||
exprs := make([]bob.Expression, 0, 5)
|
||||
|
||||
if s.FeaturePoolID.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
|
|
@ -190,6 +207,13 @@ func (s ReviewTaskPoolSetter) Expressions(prefix ...string) []bob.Expression {
|
|||
}})
|
||||
}
|
||||
|
||||
if !s.Condition.IsUnset() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "condition")...),
|
||||
psql.Arg(s.Condition),
|
||||
}})
|
||||
}
|
||||
|
||||
return exprs
|
||||
}
|
||||
|
||||
|
|
@ -565,6 +589,7 @@ type reviewTaskPoolWhere[Q psql.Filterable] struct {
|
|||
Location psql.WhereNullMod[Q, string]
|
||||
Geometry psql.WhereNullMod[Q, string]
|
||||
ReviewTaskID psql.WhereMod[Q, int32]
|
||||
Condition psql.WhereNullMod[Q, enums.Poolconditiontype]
|
||||
}
|
||||
|
||||
func (reviewTaskPoolWhere[Q]) AliasedAs(alias string) reviewTaskPoolWhere[Q] {
|
||||
|
|
@ -577,6 +602,7 @@ func buildReviewTaskPoolWhere[Q psql.Filterable](cols reviewTaskPoolColumns) rev
|
|||
Location: psql.WhereNull[Q, string](cols.Location),
|
||||
Geometry: psql.WhereNull[Q, string](cols.Geometry),
|
||||
ReviewTaskID: psql.Where[Q, int32](cols.ReviewTaskID),
|
||||
Condition: psql.WhereNull[Q, enums.Poolconditiontype](cols.Condition),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue