Documentation
¶
Overview ¶
Package analysisreport assembles reports from engine-owned computation facts.
Index ¶
- Constants
- func ApplyDetailBudget(r *analysis.AnalyzeResult, catalog *sqli18n.Catalog)
- func Build(in *analysisinput.Result, mode string, opts analysis.RequestOptions, ...) *analysis.AnalyzeResult
- func CanonicalSuggestions(issueID string, suggestions []*analysisinput.Suggestion) []*analysisinput.Suggestion
- func Decision(id, kind, stage, outcome, code string, msg analysis.Message) analysis.DecisionRecord
- func Finalize(r *analysis.AnalyzeResult, observed ...map[string]int)
- func FromRef(catalog *sqli18n.Catalog, lang string, ref *analysis.MessageRef, ...) analysis.Message
- func IssueID(i *analysisinput.Issue) string
- func Message(catalog *sqli18n.Catalog, lang, id, english string, args map[string]any) analysis.Message
- func New(context analysis.AnalysisContext, status analysis.AnalysisStatus, ...) *analysis.AnalyzeResult
- func Notice(catalog *sqli18n.Catalog, lang, code, english string) analysis.Notice
- func ProjectProposalBenefits(r *analysis.AnalyzeResult, catalog *sqli18n.Catalog, ...)
- func ProjectRewrites(r *analysis.AnalyzeResult, report *analysis.LogicalRewriteReport, ...)
- func Proposal(c analysis.CandidateReport, score int, title analysis.Message, ...) analysis.Recommendation
- func RecordComparison(e *analysis.EvaluationReport)
- func Render(catalog *sqli18n.Catalog, lang string, ref analysis.MessageRef) string
- func ScenarioIndexProposal(r *analysis.AnalyzeResult, e *analysis.EvaluationReport, ...) analysis.Recommendation
- func SuggestionCandidateID(issueID string, s *analysisinput.Suggestion) string
- func SuggestionCandidateIDs(issueID string, suggestions []*analysisinput.Suggestion) map[*analysisinput.Suggestion]string
- func UncollectedTable(engine analysis.Engine, schema, name string) analysis.TableSnapshot
- func Validate(r *analysis.AnalyzeResult) error
- func WhatIfEvaluationID(reportIdentity, alternativeID, analysisIdentity string) string
Constants ¶
const MaxDetailReportBytes = 2 << 20
MaxDetailReportBytes bounds serialized observation detail. Caller SQL and core issues/advice cannot be discarded to meet a budget; overflow is explicit.
Variables ¶
This section is empty.
Functions ¶
func ApplyDetailBudget ¶
func ApplyDetailBudget(r *analysis.AnalyzeResult, catalog *sqli18n.Catalog)
ApplyDetailBudget sheds optional detail without changing analysis decisions. Referenced identities and minimal candidate definitions are never removed.
func Build ¶
func Build(in *analysisinput.Result, mode string, opts analysis.RequestOptions, catalog *sqli18n.Catalog) *analysis.AnalyzeResult
Build projects existing engine facts. Missing instrumentation is declared, never inferred from the absence of issues or selected recommendations.
func CanonicalSuggestions ¶
func CanonicalSuggestions(issueID string, suggestions []*analysisinput.Suggestion) []*analysisinput.Suggestion
CanonicalSuggestions selects the same deterministic representatives used by Build, allowing dialect adapters to retain matching legacy guidance without reintroducing duplicates. Neither suggestions nor their payloads are mutated.
func Decision ¶
func Decision(id, kind, stage, outcome, code string, msg analysis.Message) analysis.DecisionRecord
Decision builds a uniquely scoped final or intermediate decision.
func Finalize ¶
func Finalize(r *analysis.AnalyzeResult, observed ...map[string]int)
Finalize derives counts from observed business facts and normalizes ordering.
func FromRef ¶
func FromRef(catalog *sqli18n.Catalog, lang string, ref *analysis.MessageRef, fallbackID, english string) analysis.Message
FromRef copies message arguments without redacting engine-provided values.
func IssueID ¶
func IssueID(i *analysisinput.Issue) string
IssueID deliberately excludes localized strings and process-scoped IDs.
func Message ¶
func Message(catalog *sqli18n.Catalog, lang, id, english string, args map[string]any) analysis.Message
Message renders a controlled template reference with an English fallback.
func New ¶
func New(context analysis.AnalysisContext, status analysis.AnalysisStatus, opts analysis.RequestOptions, catalog *sqli18n.Catalog) *analysis.AnalyzeResult
New initializes one report without constructing intermediate engine results.
func ProjectProposalBenefits ¶
func ProjectProposalBenefits(r *analysis.AnalyzeResult, catalog *sqli18n.Catalog, selectedEvaluationID string, canPublish func(*analysis.EvaluationReport) bool)
ProjectProposalBenefits groups only recorded exact scenarios, then copies comparisons. It never searches for combinations or executes an estimator or database operation. canPublish optionally limits benefit attribution without discarding a comparison.
func ProjectRewrites ¶
func ProjectRewrites(r *analysis.AnalyzeResult, report *analysis.LogicalRewriteReport, executable bool, catalog *sqli18n.Catalog)
ProjectRewrites projects actionable rewrite attempts as candidates and keeps no-op attempts in diagnostics when detailed recording was requested.
func Proposal ¶
func Proposal(c analysis.CandidateReport, score int, title analysis.Message, reason *analysis.Message, lang string, catalog *sqli18n.Catalog) analysis.Recommendation
Proposal projects recorded candidate facts without approving new SQL or evaluating costs.
func RecordComparison ¶
func RecordComparison(e *analysis.EvaluationReport)
RecordComparison freezes display metrics once from the recorded paired estimates. Cost percentages come from the engine comparator; reporting does not bypass its guards.
func ScenarioIndexProposal ¶
func ScenarioIndexProposal(r *analysis.AnalyzeResult, e *analysis.EvaluationReport, actions []analysis.ActionDefinition, issueIDs, rules []string, score int, title, reason analysis.Message, catalog *sqli18n.Catalog) analysis.Recommendation
ScenarioIndexProposal builds one advisory proposal from the exact index actions and provenance of a comparable physical-design scenario.
func SuggestionCandidateID ¶
func SuggestionCandidateID(issueID string, s *analysisinput.Suggestion) string
SuggestionCandidateID returns the legacy identity of one producer suggestion. Use SuggestionCandidateIDs when projecting a complete Issue's suggestions so distinct payloads sharing this legacy identity can be disambiguated.
func SuggestionCandidateIDs ¶
func SuggestionCandidateIDs(issueID string, suggestions []*analysisinput.Suggestion) map[*analysisinput.Suggestion]string
SuggestionCandidateIDs preserves unambiguous legacy identities and separates conflicting payloads deterministically. Message references use their ID and arguments, never their localized rendering. Text is a last-resort identity only when otherwise indistinguishable suggestions have no message reference.
func UncollectedTable ¶
func UncollectedTable(engine analysis.Engine, schema, name string) analysis.TableSnapshot
UncollectedTable is identity-only; it never claims an empty physical catalog.
func Validate ¶
func Validate(r *analysis.AnalyzeResult) error
Validate turns programming errors in report assembly into explicit errors.
func WhatIfEvaluationID ¶
WhatIfEvaluationID identifies a recorded alternative in the public report.
Types ¶
This section is empty.