Files
lincodex/backend/internal/adapter/secondary/postgres/sqlc/candidate_search.sql.go
T

57 lines
1.8 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
// source: candidate_search.sql
package sqlc
import (
"context"
)
const countRealComparableCategories = `-- name: CountRealComparableCategories :many
SELECT
category.specialization,
category.grade,
count(*)::bigint AS candidates
FROM candidate_assessment_categories AS category
WHERE
category.source <> 'synthetic_demo'
AND (category.specialization || '/' || category.grade) = any($1::text [])
GROUP BY category.specialization, category.grade
`
type CountRealComparableCategoriesRow struct {
Specialization string
Grade string
Candidates int64
}
// Reads that only the match search needs. The visibility of the candidates and
// their permitted evidence come from the card and evidence queries, which are
// the single copy of those barriers; this file adds no candidate-facing read.
// The number of candidates who hold each given category from a source that is
// not a synthetic demonstration, which is the size of the comparable real
// cohort that a percentile needs. It returns counts only, for the pairs the
// caller passes as "specialization/grade", and no row for a pair nobody holds.
func (q *Queries) CountRealComparableCategories(ctx context.Context, categories []string) ([]CountRealComparableCategoriesRow, error) {
rows, err := q.db.Query(ctx, countRealComparableCategories, categories)
if err != nil {
return nil, err
}
defer rows.Close()
var items []CountRealComparableCategoriesRow
for rows.Next() {
var i CountRealComparableCategoriesRow
if err := rows.Scan(&i.Specialization, &i.Grade, &i.Candidates); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}