Remove now-extraneous latitude/longitude generated columns
Now that we can pull out the geometry directly into a go object we don't need these and they complicate our insertions
This commit is contained in:
parent
34a136eba5
commit
7a361a330d
40 changed files with 426 additions and 464 deletions
27
db/query/public/feature_pool.go
Normal file
27
db/query/public/feature_pool.go
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
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 FeaturePoolsFromFeatures(ctx context.Context, txn db.Ex, site_ids []int64) ([]model.FeaturePool, error) {
|
||||
sql_ids := make([]postgres.Expression, len(site_ids))
|
||||
for i, site_id := range site_ids {
|
||||
sql_ids[i] = postgres.Int(site_id)
|
||||
}
|
||||
statement := table.FeaturePool.SELECT(
|
||||
table.FeaturePool.AllColumns,
|
||||
).FROM(table.FeaturePool).
|
||||
WHERE(table.FeaturePool.FeatureID.IN(sql_ids...))
|
||||
result, err := db.ExecuteManyTx[model.FeaturePool](ctx, txn, statement)
|
||||
if err != nil {
|
||||
return []model.FeaturePool{}, fmt.Errorf("query: %w", err)
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue