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

Function computeSQLAndByteOffset

backend/plugin/parser/mysql/completion.go:42–52  ·  view source on GitHub ↗
(statement string, caretLine int, caretOffset int, tricky bool)

Source from the content-addressed store, hash-verified

40}
41
42func computeSQLAndByteOffset(statement string, caretLine int, caretOffset int, tricky bool) (string, int) {
43 var sql string
44 var newLine, newOffset int
45 if tricky {
46 sql, newLine, newOffset = skipHeadingSQLs(statement, caretLine, caretOffset)
47 sql, newLine, newOffset = skipHeadingSQLWithoutSemicolon(sql, newLine, newOffset)
48 } else {
49 sql, newLine, newOffset = skipHeadingSQLs(statement, caretLine, caretOffset)
50 }
51 return sql, lineColumnToByteOffset(sql, newLine, newOffset)
52}
53
54func lineColumnToByteOffset(sql string, line, column int) int {
55 currentLine := 1

Callers 2

NewStandardCompleterFunction · 0.70
NewTrickyCompleterFunction · 0.70

Calls 3

skipHeadingSQLsFunction · 0.70
lineColumnToByteOffsetFunction · 0.70

Tested by

no test coverage detected