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

Function newDefaultScan

backend/plugin/parser/tsql/batch/batch.go:93–111  ·  view source on GitHub ↗
(statement string)

Source from the content-addressed store, hash-verified

91type scan func() (string, int, error)
92
93func newDefaultScan(statement string) scan {
94 // Split the statement into lines to support some client commands like GO.
95 s := strings.Split(statement, string(lineEnd))
96 byteOffset := 0
97 scanner := func() (string, int, error) {
98 if len(s) > 0 {
99 z := s[0]
100 s = s[1:]
101 byteOffsetSnapshot := byteOffset
102 byteOffset += len(z)
103 if len(s) > 0 {
104 byteOffset += len(lineEnd)
105 }
106 return z, byteOffsetSnapshot, nil
107 }
108 return "", byteOffset, io.EOF
109 }
110 return scanner
111}
112
113type Batcher struct {
114 // read provides the next chunk of runes.

Callers 1

NewBatcherFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected