// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.29.0 // source: name_rules.sql package domains import ( "context" "github.com/google/uuid" ) const getNameRuleForLabel = `-- name: GetNameRuleForLabel :one SELECT rule_id, root_claim_id, label, kind, note, created_at FROM domains.name_rules WHERE label = $1 AND (root_claim_id = $2 OR root_claim_id IS NULL) ORDER BY root_claim_id NULLS LAST LIMIT 1 ` type GetNameRuleForLabelParams struct { Label string `json:"label"` RootClaimID uuid.NullUUID `json:"root_claim_id"` } // Exact-label policy lookup, root-scoped first then global (root_claim_id // NULL). A NULL root_claim_id argument matches global rules only, since // `root_claim_id = NULL` is never true. func (q *Queries) GetNameRuleForLabel(ctx context.Context, arg GetNameRuleForLabelParams) (NameRule, error) { row := q.db.QueryRowContext(ctx, getNameRuleForLabel, arg.Label, arg.RootClaimID) var i NameRule err := row.Scan( &i.RuleID, &i.RootClaimID, &i.Label, &i.Kind, &i.Note, &i.CreatedAt, ) return i, err }