analysisinput

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package analysisinput holds engine computation inputs before report assembly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyIssueTargets

func CopyIssueTargets(targets []analysis.SQLTarget) []analysis.SQLTarget

CopyIssueTargets copies nested columns and source locations so projectors and post-processors cannot mutate concurrently readable producer facts.

func IssueScopeIdentity

func IssueScopeIdentity(targets []analysis.SQLTarget) string

IssueScopeIdentity returns a stable key for explicitly observed occurrences. Empty structural scope preserves the historical identity of producers that have never recorded alias/query-block/native-plan occurrence information.

Types

type Action

type Action struct {
	Type        analysis.ActionType `json:"type"`
	SQL         string              `json:"sql,omitempty"`
	Explanation string              `json:"explanation,omitempty"`
	// ExplanationRef identifies the message template that produced Explanation.
	ExplanationRef *analysis.MessageRef `json:"explanation_ref,omitempty"`
}

Action is emitted only when an engine can render a safe action.

type Issue

type Issue struct {
	// Targets and Evidence retain already observed structural scope and evidence.
	// They are request-local inputs, not an extension of the legacy JSON shape.
	Targets     []analysis.SQLTarget   `json:"-"`
	Evidence    []analysis.EvidenceRef `json:"-"`
	Rule        string                 `json:"rule"`
	Source      analysis.IssueSource   `json:"source"`
	Category    string                 `json:"category"`
	Type        string                 `json:"type"`
	Severity    analysis.Severity      `json:"severity"`
	Clause      string                 `json:"clause,omitempty"`
	Schema      string                 `json:"schema,omitempty"`
	Table       string                 `json:"table,omitempty"`
	Column      string                 `json:"column,omitempty"`
	Location    *analysis.Location     `json:"location,omitempty"`
	Description string                 `json:"description"`
	// DescriptionRef identifies the message template that produced Description.
	DescriptionRef *analysis.MessageRef `json:"description_ref,omitempty"`
	Suggestions    []*Suggestion        `json:"suggestions,omitempty"`
}

Issue is an engine-neutral diagnostic summary. Rule evidence and triggering logic remain engine-specific.

type RecordedIndexCandidate

type RecordedIndexCandidate struct {
	SuggestionID string
	Target       analysis.SQLTarget
	Design       analysis.IndexDefinition
	Safe         bool
}

RecordedIndexCandidate preserves a design without parsing rendered SQL.

type Recording

type Recording struct {
	PolicyIdentity  string
	Stages          []analysis.CheckRecord
	Checks          []analysis.CheckRecord
	Findings        []*Issue
	Tables          []analysis.TableSnapshot
	IndexCandidates []RecordedIndexCandidate
}

Recording retains evidence at its owning pipeline boundary.

type Result

type Result struct {
	// Recording carries request-local observations, not persisted legacy facts.
	Recording     *Recording      `json:"-"`
	SQL           string          `json:"sql"`
	Engine        analysis.Engine `json:"engine"`
	EngineVersion string          `json:"engine_version,omitempty"`
	// Language records the language used to materialize the message text.
	Language        string                         `json:"language,omitempty"`
	Database        string                         `json:"database,omitempty"`
	DefaultSchema   string                         `json:"default_schema,omitempty"`
	Profile         analysis.VersionProfile        `json:"profile"`
	Capabilities    []analysis.CapabilityStatus    `json:"capabilities,omitempty"`
	Status          analysis.AnalysisStatus        `json:"status"`
	Issues          []*Issue                       `json:"issues,omitempty"`
	NativeExplain   *analysis.NativeExplainSummary `json:"native_explain,omitempty"`
	WhatIf          *analysis.WhatIfEvaluation     `json:"what_if,omitempty"`
	LogicalRewrites *analysis.LogicalRewriteReport `json:"logical_rewrites,omitempty"`
	TablesAnalyzed  []analysis.RelationRef         `json:"tables_analyzed,omitempty"`
	Warnings        []analysis.Diagnostic          `json:"warnings,omitempty"`
	Unsupported     []analysis.Diagnostic          `json:"unsupported,omitempty"`
}

Result holds engine computation facts before public report assembly.

func (*Result) Canonicalize

func (result *Result) Canonicalize()

Canonicalize sorts and deduplicates result slices so JSON output does not depend on map traversal or discovery order.

type Suggestion

type Suggestion struct {
	ID       string                  `json:"id,omitempty"`
	Type     analysis.SuggestionType `json:"type"`
	Priority int                     `json:"priority,omitempty"`
	Summary  string                  `json:"summary"`
	Reason   string                  `json:"reason,omitempty"`
	Target   *analysis.RelationRef   `json:"target,omitempty"`
	Action   *Action                 `json:"action,omitempty"`
	// SummaryRef identifies the message template that produced Summary.
	SummaryRef *analysis.MessageRef `json:"summary_ref,omitempty"`
	// ReasonRef identifies the message template that produced Reason.
	ReasonRef *analysis.MessageRef `json:"reason_ref,omitempty"`
}

Suggestion explains a recommendation and optionally carries a safe action.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL