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

Function convertStatements

backend/plugin/parser/mongodb/mongodb.go:62–88  ·  view source on GitHub ↗
(input string, stmts []mongo.Statement)

Source from the content-addressed store, hash-verified

60}
61
62func convertStatements(input string, stmts []mongo.Statement) []base.ParsedStatement {
63 var result []base.ParsedStatement
64 positionMapper := base.NewByteOffsetPositionMapper(input)
65 for _, stmt := range stmts {
66 if stmt.Empty() {
67 continue
68 }
69 startPos := positionMapper.Position(stmt.ByteStart)
70 endPos := positionMapper.Position(stmt.ByteEnd)
71 result = append(result, base.ParsedStatement{
72 Statement: base.Statement{
73 Text: stmt.Text,
74 Start: startPos,
75 End: endPos,
76 Range: &storepb.Range{
77 Start: int32(stmt.ByteStart),
78 End: int32(stmt.ByteEnd),
79 },
80 },
81 AST: &OmniAST{
82 Node: stmt.AST,
83 StartPosition: startPos,
84 },
85 })
86 }
87 return result
88}

Callers 2

ParseMongoShellFunction · 0.85

Calls 2

PositionMethod · 0.95

Tested by

no test coverage detected