nidus-sync/db/query/public/feature_pool.go
Eli Ribble 7237f5f666
Some checks failed
/ golint (push) Failing after 3m50s
Move internal references to new source hosting
2026-05-19 15:33:57 +00:00

27 lines
888 B
Go

package public
import (
"context"
"fmt"
"github.com/Gleipnir-Technology/jet/postgres"
"source.gleipnir.technology/Gleipnir/nidus-sync/db"
"source.gleipnir.technology/Gleipnir/nidus-sync/db/gen/nidus-sync/public/model"
"source.gleipnir.technology/Gleipnir/nidus-sync/db/gen/nidus-sync/public/table"
)
func FeaturePoolsFromFeatures(ctx context.Context, txn db.Ex, feature_ids []int64) ([]model.FeaturePool, error) {
sql_ids := make([]postgres.Expression, len(feature_ids))
for i, site_id := range feature_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
}