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

Function splitPGSearchPath

backend/store/model/pg_search_path.go:92–118  ·  view source on GitHub ↗
(searchPath string)

Source from the content-addressed store, hash-verified

90}
91
92func splitPGSearchPath(searchPath string) []string {
93 var parts []string
94 start := 0
95 var quote byte
96
97 for i := 0; i < len(searchPath); i++ {
98 switch {
99 case quote != 0:
100 if searchPath[i] != quote {
101 continue
102 }
103 if i+1 < len(searchPath) && searchPath[i+1] == quote {
104 i++
105 continue
106 }
107 quote = 0
108 case searchPath[i] == '"' || searchPath[i] == '\'':
109 quote = searchPath[i]
110 case searchPath[i] == ',':
111 parts = append(parts, searchPath[start:i])
112 start = i + 1
113 default:
114 }
115 }
116 parts = append(parts, searchPath[start:])
117 return parts
118}
119
120// isPGSystemPath checks if a path is a PostgreSQL system schema.
121func isPGSystemPath(path string) bool {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected