Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/platform/database/dbgen/opportunities.sql.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/platform/database/dbgen/opportunities.sql.go |
| Original SHA-256 | 7b20aee1d62bb2e092734daac475630a9fd5080f3b699d46944715a462646704 |
| Git blob SHA | 46e5df22b6287f98905f3fd8cf6bad2ca9cfefc9 |
| Reading-copy SHA-256 | 7b20aee1d62bb2e092734daac475630a9fd5080f3b699d46944715a462646704 |
Every recorded occurrence
These 18 records contain identical original source bytes. Their paths and revisions remain part of the archive.
| Original record | Branch or archive | Revision / identifier | Original location |
|---|---|---|---|
| Janady13/missionmatch / internal/platform/database/dbgen/opportunities.sql.go | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / internal/platform/database/dbgen/opportunities.sql.go | collision-deconfliction | 4ee5a09972608ed89f8377c6665542d5f450f0a6 | Open original |
| Janady13/missionmatch / internal/platform/database/dbgen/opportunities.sql.go | ws6-retrieval | 6c56e29231ec05735927fa265c97d517499dfeaf | Open original |
| Janady13/missionmatch / internal/platform/database/dbgen/opportunities.sql.go | m5-price-to-win | 41000ad30fff4129fdaf5ec84e15ba14c27d4890 | Open original |
| Janady13/missionmatch / internal/platform/database/dbgen/opportunities.sql.go | master | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 | Open original |
| Janady13/missionmatch / internal/platform/database/dbgen/opportunities.sql.go | ws8-teaching-loop | c823f0fb6bb2aba0f39001eb6de96f4000d9321f | Open original |
| Janady13/missionmatch / internal/platform/database/dbgen/opportunities.sql.go | mag-substrate | b82c7100a492dec67dfd1eda6b3f53def859be35 | Open original |
| Janady13/missionmatch / internal/platform/database/dbgen/opportunities.sql.go | ws3-clearance | 4b8e7ce594c068621867f9c9deed0ec64ae6c553 | Open original |
| Janady13/missionmatch / internal/platform/database/dbgen/opportunities.sql.go | phase2-eval-fairness | d361af254701975fe239927656ababb56374655e | Open original |
| Janady13/missionmatch / internal/platform/database/dbgen/opportunities.sql.go | time-to-fill-survival | b66e1e505863d4f17741a4b9ede73509e45bd6c6 | Open original |
| Janady13/missionmatch / internal/platform/database/dbgen/opportunities.sql.go | graphrag-foundation | b0ddeb9f633fd138d09309d1a17b7d13bc3a67f7 | Open original |
| Janady13/missionmatch / internal/platform/database/dbgen/opportunities.sql.go | ws9-bench-ingestion | f585a9ef32fa554663ce1fba9a414a54b6e49cf0 | Open original |
| Janady13/missionmatch / internal/platform/database/dbgen/opportunities.sql.go | presentation-readiness | eb574acaa29d71ce4d0f852572e87c275c79fdb7 | Open original |
| Janady13/missionmatch / internal/platform/database/dbgen/opportunities.sql.go | vendor-intelligence | fe9796a19c261951d3f2565206c0c1b5ac294465 | Open original |
| Janady13/missionmatch / internal/platform/database/dbgen/opportunities.sql.go | ws7-federal-signal | 6a9f6ce9cfb13345ffb47770d4960e7c2d9c17c2 | Open original |
| Janady13/missionmatch / internal/platform/database/dbgen/opportunities.sql.go | phase2-connectors | e038d4c687aec16f8bd9bc4d907eea14d91f8704 | Open original |
| Janady13/missionmatch / internal/platform/database/dbgen/opportunities.sql.go | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
| Janady13/missionmatch / internal/platform/database/dbgen/opportunities.sql.go | capture-readiness | bae6af7cb2997e819174a9e9cfff5e16067a1975 | Open original |
Recovered source transcript
Download complete source text ↓202 lines · 5.4 KB
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
// source: opportunities.sql
package dbgen
import (
"context"
"github.com/google/uuid"
"github.com/jackc/pgx/v5/pgtype"
)
const createOpportunity = `-- name: CreateOpportunity :one
INSERT INTO opportunities (organization_id, name, solicitation_number, customer_agency, due_date, status)
VALUES ($1,$2,$3,$4,$5,$6)
RETURNING id, organization_id, name, solicitation_number, customer_agency, due_date, status, created_at, updated_at, value, value_source, federal_ref
`
type CreateOpportunityParams struct {
OrganizationID uuid.UUID `json:"organization_id"`
Name string `json:"name"`
SolicitationNumber *string `json:"solicitation_number"`
CustomerAgency *string `json:"customer_agency"`
DueDate pgtype.Date `json:"due_date"`
Status string `json:"status"`
}
func (q *Queries) CreateOpportunity(ctx context.Context, arg CreateOpportunityParams) (Opportunity, error) {
row := q.db.QueryRow(ctx, createOpportunity,
arg.OrganizationID,
arg.Name,
arg.SolicitationNumber,
arg.CustomerAgency,
arg.DueDate,
arg.Status,
)
var i Opportunity
err := row.Scan(
&i.ID,
&i.OrganizationID,
&i.Name,
&i.SolicitationNumber,
&i.CustomerAgency,
&i.DueDate,
&i.Status,
&i.CreatedAt,
&i.UpdatedAt,
&i.Value,
&i.ValueSource,
&i.FederalRef,
)
return i, err
}
const getOpportunity = `-- name: GetOpportunity :one
SELECT id, organization_id, name, solicitation_number, customer_agency, due_date, status, created_at, updated_at, value, value_source, federal_ref FROM opportunities WHERE id = $1
`
func (q *Queries) GetOpportunity(ctx context.Context, id uuid.UUID) (Opportunity, error) {
row := q.db.QueryRow(ctx, getOpportunity, id)
var i Opportunity
err := row.Scan(
&i.ID,
&i.OrganizationID,
&i.Name,
&i.SolicitationNumber,
&i.CustomerAgency,
&i.DueDate,
&i.Status,
&i.CreatedAt,
&i.UpdatedAt,
&i.Value,
&i.ValueSource,
&i.FederalRef,
)
return i, err
}
const listOpportunities = `-- name: ListOpportunities :many
SELECT id, organization_id, name, solicitation_number, customer_agency, due_date, status, created_at, updated_at, value, value_source, federal_ref FROM opportunities ORDER BY created_at DESC, id DESC LIMIT $1 OFFSET $2
`
type ListOpportunitiesParams struct {
Limit int32 `json:"limit"`
Offset int32 `json:"offset"`
}
func (q *Queries) ListOpportunities(ctx context.Context, arg ListOpportunitiesParams) ([]Opportunity, error) {
rows, err := q.db.Query(ctx, listOpportunities, arg.Limit, arg.Offset)
if err != nil {
return nil, err
}
defer rows.Close()
items := []Opportunity{}
for rows.Next() {
var i Opportunity
if err := rows.Scan(
&i.ID,
&i.OrganizationID,
&i.Name,
&i.SolicitationNumber,
&i.CustomerAgency,
&i.DueDate,
&i.Status,
&i.CreatedAt,
&i.UpdatedAt,
&i.Value,
&i.ValueSource,
&i.FederalRef,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const listRequirementsForOpportunity = `-- name: ListRequirementsForOpportunity :many
SELECT id, organization_id, opportunity_id, title, customer_agency, required_level, required_poly, required_years, work_location, remote_allowed, key_personnel, created_at, updated_at, deleted_at, labor_category, quantity, required_compartments FROM requirements WHERE opportunity_id = $1 AND deleted_at IS NULL ORDER BY created_at DESC, id DESC
`
func (q *Queries) ListRequirementsForOpportunity(ctx context.Context, opportunityID *uuid.UUID) ([]Requirement, error) {
rows, err := q.db.Query(ctx, listRequirementsForOpportunity, opportunityID)
if err != nil {
return nil, err
}
defer rows.Close()
items := []Requirement{}
for rows.Next() {
var i Requirement
if err := rows.Scan(
&i.ID,
&i.OrganizationID,
&i.OpportunityID,
&i.Title,
&i.CustomerAgency,
&i.RequiredLevel,
&i.RequiredPoly,
&i.RequiredYears,
&i.WorkLocation,
&i.RemoteAllowed,
&i.KeyPersonnel,
&i.CreatedAt,
&i.UpdatedAt,
&i.DeletedAt,
&i.LaborCategory,
&i.Quantity,
&i.RequiredCompartments,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const proposalReadiness = `-- name: ProposalReadiness :many
SELECT sm.band, sm.decision, COUNT(*) AS n
FROM requirements r
JOIN slates s ON s.requirement_id = r.id
JOIN slate_members sm ON sm.slate_id = s.id
WHERE r.opportunity_id = $1
GROUP BY sm.band, sm.decision
ORDER BY sm.band, sm.decision
`
type ProposalReadinessRow struct {
Band string `json:"band"`
Decision string `json:"decision"`
N int64 `json:"n"`
}
// Band/decision rollup across every slate member under one opportunity's requirements, the source
// for GET /proposal-readiness [review COMPL-2]. RLS scopes all three tables to the caller's org.
func (q *Queries) ProposalReadiness(ctx context.Context, opportunityID *uuid.UUID) ([]ProposalReadinessRow, error) {
rows, err := q.db.Query(ctx, proposalReadiness, opportunityID)
if err != nil {
return nil, err
}
defer rows.Close()
items := []ProposalReadinessRow{}
for rows.Next() {
var i ProposalReadinessRow
if err := rows.Scan(&i.Band, &i.Decision, &i.N); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}