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

Function isObjectIdentifierCandidate

backend/plugin/parser/tidb/completion.go:334–348  ·  view source on GitHub ↗

isObjectIdentifierCandidate reports whether a candidate type names a schema object referenced as an identifier in SQL (and so must be backtick-quoted when it is a reserved word or a non-bare name). Keywords, builtin functions, and value-like candidates (charset/engine/variable/type) are excluded.

(t base.CandidateType)

Source from the content-addressed store, hash-verified

332// when it is a reserved word or a non-bare name). Keywords, builtin functions,
333// and value-like candidates (charset/engine/variable/type) are excluded.
334func isObjectIdentifierCandidate(t base.CandidateType) bool {
335 switch t {
336 case base.CandidateTypeDatabase,
337 base.CandidateTypeTable,
338 base.CandidateTypeView,
339 base.CandidateTypeColumn,
340 base.CandidateTypeIndex,
341 base.CandidateTypeTrigger,
342 base.CandidateTypeEvent,
343 base.CandidateTypeRoutine:
344 return true
345 default:
346 return false
347 }
348}
349
350// quoteIdentifierIfNeeded backtick-quotes an object identifier when it would
351// otherwise be invalid as a bare identifier, so that accepting the completion

Callers 1

CompletionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected