Now that we can pull out the geometry directly into a go object we don't need these and they complicate our insertions
23 lines
694 B
Go
23 lines
694 B
Go
package public
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/Gleipnir-Technology/nidus-sync/db"
|
|
"github.com/Gleipnir-Technology/nidus-sync/db/gen/nidus-sync/public/model"
|
|
"github.com/Gleipnir-Technology/nidus-sync/db/gen/nidus-sync/public/table"
|
|
"github.com/go-jet/jet/v2/postgres"
|
|
)
|
|
|
|
func FeaturesFromSiteID(ctx context.Context, txn db.Ex, site_id int64) ([]model.Feature, error) {
|
|
statement := table.Feature.SELECT(
|
|
table.Feature.AllColumns,
|
|
).FROM(table.Feature).
|
|
WHERE(table.Feature.SiteID.EQ(postgres.Int(site_id)))
|
|
result, err := db.ExecuteManyTx[model.Feature](ctx, txn, statement)
|
|
if err != nil {
|
|
return []model.Feature{}, fmt.Errorf("query: %w", err)
|
|
}
|
|
return result, nil
|
|
}
|