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

Function GetTiDBAST

backend/plugin/parser/tidb/ast.go:39–50  ·  view source on GitHub ↗

GetTiDBAST extracts the TiDB AST from a base.AST. Returns the AST and true if it is a TiDB AST, nil and false otherwise. Also checks for PingCapASTProvider implementations (e.g. *OmniAST during the advisor migration), which lazily build a native pingcap AST on demand.

(a base.AST)

Source from the content-addressed store, hash-verified

37// Also checks for PingCapASTProvider implementations (e.g. *OmniAST during
38// the advisor migration), which lazily build a native pingcap AST on demand.
39func GetTiDBAST(a base.AST) (*AST, bool) {
40 if a == nil {
41 return nil, false
42 }
43 if tidbAST, ok := a.(*AST); ok {
44 return tidbAST, true
45 }
46 if provider, ok := a.(PingCapASTProvider); ok {
47 return provider.AsPingCapAST()
48 }
49 return nil, false
50}

Callers 4

WalkThroughFunction · 0.92
extractChangedResourcesFunction · 0.85
GetStatementTypesFunction · 0.85

Calls 1

AsPingCapASTMethod · 0.65

Tested by 1