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

Function lastIdentifierSpan

backend/plugin/parser/plsql/completion.go:881–904  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

879}
880
881func lastIdentifierSpan(s string) (string, int) {
882 s = strings.TrimSpace(s)
883 if s == "" {
884 return "", 0
885 }
886 if s[len(s)-1] == '"' {
887 for i := len(s) - 2; i >= 0; i-- {
888 if s[i] == '"' {
889 return s[i:], i
890 }
891 }
892 return "", 0
893 }
894 end := len(s)
895 start := end
896 for start > 0 {
897 r, size := utf8.DecodeLastRuneInString(s[:start])
898 if !unicode.IsLetter(r) && !unicode.IsDigit(r) && r != '_' && r != '$' && r != '#' {
899 break
900 }
901 start -= size
902 }
903 return s[start:end], start
904}
905
906func (c *Completer) columnQualifier() (schema, table string) {
907 parts := c.qualifierParts()

Callers 1

qualifierPartsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected