Documentation
¶
Overview ¶
Package deltascope exposes the public library surface for consumers. input: public audit requests carrying SQL text, dialect, optional config path, and optional metadata providers output: stable audit results for embedding DeltaScope in tools and agents pos: public audit API above the internal application service note: if this file changes, update this header and module README.md.
Package deltascope exposes the public library surface for consumers. input: external library calls into the DeltaScope audit engine output: stable exported API for embedding DeltaScope pos: public package boundary above internal application services note: if this file changes, update this header and module README.md.
Package deltascope exposes the stable public audit API. input: build metadata consumers and public version/logo queries output: shared default version and ASCII logo values for CLIs and services pos: public package metadata alongside the stable audit entrypoint note: if this file changes, update this header and module README.md.
Index ¶
- Constants
- type Column
- type Constraint
- type Dialect
- type Explanation
- type ExplanationMetadata
- type Finding
- type FindingExplanation
- type Index
- type InstanceFacts
- type Level
- type Location
- type Metadata
- type MetadataProvider
- type Request
- type Result
- type StatementResult
- type Summary
- type Table
- type TableSnapshot
- type Verdict
Constants ¶
const ( // DefaultVersion is the repository's current default semantic version. DefaultVersion = "v0.9.0" // Logo is the canonical ASCII DeltaScope banner used by human-facing commands. Logo = " ____ ____ _____ \n" + " / __ \\___ / / /_____ _/ ___/_________ ____ ___ \n" + " / / / / _ \\/ / __/ __ `/\\__ \\/ ___/ __ \\/ __ \\/ _ \\\n" + " / /_/ / __/ / /_/ /_/ /___/ / /__/ /_/ / /_/ / __/\n" + "/_____/\\___/_/\\__/\\__,_//____/\\___/\\____/ .___/\\___/ \n" + " /_/ " )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Constraint ¶
type Constraint = spec.Constraint
Constraint mirrors the domain constraint shape used inside metadata snapshots.
type Explanation ¶ added in v0.6.2
type Explanation struct {
Summary string `json:"summary,omitempty"`
Reasons []string `json:"reasons,omitempty"`
}
Explanation is the stable public result-level explanation shape.
type ExplanationMetadata ¶ added in v0.6.2
type ExplanationMetadata struct {
Status string `json:"status,omitempty"`
Note string `json:"note,omitempty"`
}
ExplanationMetadata describes how metadata availability affected a public finding explanation.
type Finding ¶
type Finding struct {
RuleID string `json:"rule_id"`
Level Level `json:"level"`
Message string `json:"message"`
StatementIndex int `json:"statement_index,omitempty"`
StatementKind string `json:"statement_kind,omitempty"`
Location *Location `json:"location,omitempty"`
Suggestion string `json:"suggestion,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
Explanation *FindingExplanation `json:"explanation,omitempty"`
}
Finding is the stable public finding shape.
type FindingExplanation ¶ added in v0.6.2
type FindingExplanation struct {
Summary string `json:"summary,omitempty"`
Why string `json:"why,omitempty"`
Risk string `json:"risk,omitempty"`
Suggestion string `json:"suggestion,omitempty"`
Metadata *ExplanationMetadata `json:"metadata,omitempty"`
}
FindingExplanation is the stable public per-finding explanation shape.
type InstanceFacts ¶
type InstanceFacts = spec.InstanceFacts
InstanceFacts mirror metadata-aware instance facts for public providers.
type MetadataProvider ¶
type MetadataProvider interface {
LoadInstanceFacts(ctx context.Context, dialect Dialect, schema string) (*InstanceFacts, error)
LoadTableSnapshot(ctx context.Context, dialect Dialect, schema string, table string) (*TableSnapshot, error)
}
MetadataProvider supplies optional metadata-aware facts for one public audit request.
type Request ¶
type Request struct {
SQL string
Dialect Dialect
ConfigPath string
Schema string
MetadataProvider MetadataProvider
}
Request describes one public audit invocation.
type Result ¶
type Result struct {
Verdict Verdict `json:"verdict"`
Summary Summary `json:"summary"`
Statements []StatementResult `json:"statements,omitempty"`
GlobalFindings []Finding `json:"global_findings,omitempty"`
Explanation *Explanation `json:"explanation,omitempty"`
}
Result is the stable public audit output.
type StatementResult ¶
type StatementResult struct {
Index int `json:"index"`
Kind string `json:"kind"`
RawSQL string `json:"raw_sql,omitempty"`
NormalizedSQL string `json:"normalized_sql,omitempty"`
Findings []Finding `json:"findings,omitempty"`
Explanation *Explanation `json:"explanation,omitempty"`
}
StatementResult stores public findings for a single SQL statement.
type Summary ¶
type Summary struct {
Statements int `json:"statements"`
Blockers int `json:"blockers"`
Warnings int `json:"warnings"`
Notices int `json:"notices"`
}
Summary captures high-level public audit counts.
type TableSnapshot ¶
type TableSnapshot = spec.TableSnapshot
TableSnapshot mirrors metadata-aware target table snapshots for public providers.