MCPcopy Create free account
hub / github.com/bytebase/bytebase / extractNodeText

Function extractNodeText

backend/plugin/parser/pg/backup.go:268–273  ·  view source on GitHub ↗

extractNodeText extracts trimmed text from SQL using a Loc range.

(loc ast.Loc, sql string)

Source from the content-addressed store, hash-verified

266
267// extractNodeText extracts trimmed text from SQL using a Loc range.
268func extractNodeText(loc ast.Loc, sql string) string {
269 if loc.Start < 0 || loc.End < 0 || loc.Start >= loc.End || loc.End > len(sql) {
270 return ""
271 }
272 return strings.TrimSpace(sql[loc.Start:loc.End])
273}
274
275func prepareTransformation(ctx context.Context, tCtx base.TransformContext, statement string) ([]statementInfo, error) {
276 stmts, err := ParsePg(statement)

Callers 3

extractCTEFunction · 0.85
writeUpdateSuffixFunction · 0.85
writeDeleteSuffixFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected