parser

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatExecuteStmt added in v0.22.0

func FormatExecuteStmt(es *ExecuteStmt) string

FormatExecuteStmt formats an ExecuteStmt as SQL with the directive comment.

func FormatExecuteStmtWithNote added in v1.23.0

func FormatExecuteStmtWithNote(es *ExecuteStmt, note string) string

FormatExecuteStmtWithNote formats an ExecuteStmt with an extra comment line between the directive and the SQL. note is used by plan to record that the check SQL could not be evaluated, so the statement is shown without a verdict. Newlines in note are folded to keep the comment on one line.

Types

type ExecuteStmt added in v0.22.0

type ExecuteStmt struct {
	SQL      string // The SQL statement to execute
	CheckSQL string // Optional condition check SQL (empty = always execute)
	// First reports whether the statement came from -- pista:execute-first,
	// which runs before the managed DDL instead of after it. Its check SQL is
	// therefore evaluated against the pre-change schema.
	First bool
}

ExecuteStmt represents an arbitrary SQL statement marked with -- pista:execute or -- pista:execute-first.

type ParseResult

type ParseResult struct {
	Tables         *orderedmap.Map[string, *model.Table]
	Views          *orderedmap.Map[string, *model.View]
	Enums          *orderedmap.Map[string, *model.Enum]
	Domains        *orderedmap.Map[string, *model.Domain]
	CompositeTypes *orderedmap.Map[string, *model.CompositeType]
	Sequences      *orderedmap.Map[string, *model.Sequence]
	ExecuteStmts   []*ExecuteStmt
}

func ParseSQLFilesWithSchema added in v0.4.0

func ParseSQLFilesWithSchema(paths []string, defaultSchema string) (*ParseResult, error)

Jump to

Keyboard shortcuts

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