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

Function dmlNodeLoc

backend/plugin/parser/tsql/backup.go:561–596  ·  view source on GitHub ↗
(node ast.Node)

Source from the content-addressed store, hash-verified

559}
560
561func dmlNodeLoc(node ast.Node) ast.Loc {
562 if common.IsNil(node) {
563 return ast.NoLoc()
564 }
565 switch n := node.(type) {
566 case *ast.UpdateStmt:
567 return n.Loc
568 case *ast.DeleteStmt:
569 return n.Loc
570 case *ast.TopClause:
571 return n.Loc
572 case *ast.TableRef:
573 return n.Loc
574 case *ast.TableVarRef:
575 return n.Loc
576 case *ast.TableVarMethodCallRef:
577 return n.Loc
578 case *ast.AliasedTableRef:
579 return n.Loc
580 case *ast.JoinClause:
581 loc := n.Loc
582 leftLoc := dmlNodeLoc(n.Left)
583 if leftLoc.Start >= 0 && (loc.Start < 0 || leftLoc.Start < loc.Start) {
584 loc.Start = leftLoc.Start
585 }
586 return loc
587 case *ast.SetExpr:
588 return n.Loc
589 default:
590 loc := omniNodeLoc(node)
591 if loc.Start >= 0 {
592 return loc
593 }
594 return ast.NoLoc()
595 }
596}

Callers 7

prepareTransformationFunction · 0.85
dmlFromSourceFunction · 0.85
dmlTailStartFunction · 0.85
listLocFunction · 0.85
GenerateRestoreSQLFunction · 0.85
extractStatementFunction · 0.85

Calls 2

IsNilFunction · 0.92
omniNodeLocFunction · 0.70

Tested by

no test coverage detected