Documentation
¶
Overview ¶
Package sqlutil exposes stable SQL analysis helpers for tools that need to classify statements without depending on tinySQL's internal engine package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsReadOnly ¶
IsReadOnly returns true when sql parses as a read-only statement.
func IsResultProducing ¶
IsResultProducing returns true for statements expected to return rows.
Types ¶
type Analysis ¶
type Analysis struct {
Kind StatementKind
ObjectName string
ReadOnly bool
ResultProducing bool
Mutation bool
DDL bool
Job bool
}
Analysis describes a parsed SQL statement at a level suitable for UI guards, auto-run checks, and audit labels.
func AnalyzeStatement ¶
AnalyzeStatement classifies an already parsed statement.
type StatementKind ¶
type StatementKind string
StatementKind is a coarse statement classification.
const ( // StatementKind values classify SQL statements at a coarse, stable level. KindUnknown StatementKind = "unknown" KindSelect StatementKind = "select" KindExplain StatementKind = "explain" KindAnalyze StatementKind = "analyze" KindPragma StatementKind = "pragma" KindInsert StatementKind = "insert" KindUpdate StatementKind = "update" KindDelete StatementKind = "delete" KindCreateTable StatementKind = "create_table" KindDropTable StatementKind = "drop_table" KindCreateIndex StatementKind = "create_index" KindDropIndex StatementKind = "drop_index" KindCreateView StatementKind = "create_view" KindDropView StatementKind = "drop_view" KindCreateMaterializedView StatementKind = "create_materialized_view" KindDropMaterializedView StatementKind = "drop_materialized_view" KindRefreshMaterialized StatementKind = "refresh_materialized_view" KindAlter StatementKind = "alter" KindCreateTrigger StatementKind = "create_trigger" KindDropTrigger StatementKind = "drop_trigger" KindCreateJob StatementKind = "create_job" KindAlterJob StatementKind = "alter_job" KindDropJob StatementKind = "drop_job" )
Click to show internal directories.
Click to hide internal directories.