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

Function mysqlNodeLoc

backend/plugin/db/mysql/query.go:278–299  ·  view source on GitHub ↗
(node ast.Node)

Source from the content-addressed store, hash-verified

276}
277
278func mysqlNodeLoc(node ast.Node) ast.Loc {
279 if node == nil {
280 return ast.Loc{Start: -1, End: -1}
281 }
282 value := reflect.ValueOf(node)
283 if value.Kind() != reflect.Pointer || value.IsNil() {
284 return ast.Loc{Start: -1, End: -1}
285 }
286 elem := value.Elem()
287 if elem.Kind() != reflect.Struct {
288 return ast.Loc{Start: -1, End: -1}
289 }
290 field := elem.FieldByName("Loc")
291 if !field.IsValid() || !field.CanInterface() {
292 return ast.Loc{Start: -1, End: -1}
293 }
294 loc, ok := field.Interface().(ast.Loc)
295 if !ok {
296 return ast.Loc{Start: -1, End: -1}
297 }
298 return loc
299}
300
301func findMySQLKeywordBefore(sql string, offset int, keyword string) int {
302 if offset > len(sql) {

Callers 2

nodeLocOfFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected