(sql string, offset int, keyword string)
| 299 | } |
| 300 | |
| 301 | func findMySQLKeywordBefore(sql string, offset int, keyword string) int { |
| 302 | if offset > len(sql) { |
| 303 | offset = len(sql) |
| 304 | } |
| 305 | if len(keyword) == 0 { |
| 306 | return offset |
| 307 | } |
| 308 | keyword = strings.ToUpper(keyword) |
| 309 | tokens := omnimysqlparser.Tokenize(sql[:offset]) |
| 310 | for i := len(tokens) - 1; i >= 0; i-- { |
| 311 | token := tokens[i] |
| 312 | if token.End <= offset && omnimysqlparser.TokenName(token.Type) == keyword { |
| 313 | return token.Loc |
| 314 | } |
| 315 | } |
| 316 | return offset |
| 317 | } |
no outgoing calls
no test coverage detected