MCPcopy
hub / github.com/jmoiron/sqlx / findMatchingClosingBracketIndex

Function findMatchingClosingBracketIndex

named.go:229–243  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

227var valuesReg = regexp.MustCompile(`\)\s*(?i)VALUES\s*\(`)
228
229func findMatchingClosingBracketIndex(s string) int {
230 count := 0
231 for i, ch := range s {
232 if ch == '(' {
233 count++
234 }
235 if ch == ')' {
236 count--
237 if count == 0 {
238 return i
239 }
240 }
241 }
242 return 0
243}
244
245func fixBound(bound string, loop int) string {
246 loc := valuesReg.FindStringIndex(bound)

Callers 1

fixBoundFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected