nidus-sync/db/query/arcgis/service_feature.go
Eli Ribble fcd95f1a25
Get back to compiling, but using new jet for publicreport
This was an epically long change, and a terrible idea, but it compiles.
This was essentially a cascade that came about because I can't blend jet
and bob in the same transaction. In for a penny, I guess...
2026-05-07 10:39:17 +00:00

31 lines
1.2 KiB
Go

package arcgis
import (
"context"
"github.com/Gleipnir-Technology/bob"
"github.com/Gleipnir-Technology/nidus-sync/db"
"github.com/Gleipnir-Technology/nidus-sync/db/gen/nidus-sync/arcgis/model"
"github.com/Gleipnir-Technology/nidus-sync/db/gen/nidus-sync/arcgis/table"
"github.com/go-jet/jet/v2/postgres"
)
func ServiceFeatureFromID(ctx context.Context, id string) (model.ServiceFeature, error) {
statement := table.ServiceFeature.SELECT(
table.ServiceFeature.AllColumns,
).FROM(table.ServiceFeature).
WHERE(table.ServiceFeature.ItemID.EQ(postgres.String(id)))
return db.ExecuteOne[model.ServiceFeature](ctx, statement)
}
func ServiceFeatureFromURL(ctx context.Context, url string) (model.ServiceFeature, error) {
statement := table.ServiceFeature.SELECT(
table.ServiceFeature.AllColumns,
).FROM(table.ServiceFeature).
WHERE(table.ServiceFeature.URL.EQ(postgres.String(url)))
return db.ExecuteOne[model.ServiceFeature](ctx, statement)
}
func ServiceFeatureInsert(ctx context.Context, txn bob.Tx, m model.ServiceFeature) error {
statement := table.ServiceMap.INSERT(table.ServiceMap.MutableColumns).
MODEL(m)
return db.ExecuteNoneTxBob(ctx, txn, statement)
}