MCPcopy Index your code
hub / github.com/bytebase/bytebase / ExtractASTs

Function ExtractASTs

backend/plugin/parser/base/statement.go:74–82  ·  view source on GitHub ↗

ExtractASTs extracts non-nil ASTs from a slice of ParsedStatements. Empty statements (with nil AST) are skipped. Returns nil if no ASTs are found (preserves nil-check compatibility). This is useful for backward compatibility when migrating from []AST to []ParsedStatement.

(stmts []ParsedStatement)

Source from the content-addressed store, hash-verified

72// Returns nil if no ASTs are found (preserves nil-check compatibility).
73// This is useful for backward compatibility when migrating from []AST to []ParsedStatement.
74func ExtractASTs(stmts []ParsedStatement) []AST {
75 var asts []AST
76 for _, stmt := range stmts {
77 if stmt.AST != nil {
78 asts = append(asts, stmt.AST)
79 }
80 }
81 return asts
82}

Calls

no outgoing calls