(token string)
| 63 | } |
| 64 | |
| 65 | func parsePGSearchPathItem(token string) (PGSearchPathItem, bool) { |
| 66 | token = strings.TrimSpace(token) |
| 67 | if token == "" { |
| 68 | return PGSearchPathItem{}, false |
| 69 | } |
| 70 | |
| 71 | schema := strings.ToLower(token) |
| 72 | switch { |
| 73 | case len(token) >= 2 && token[0] == '"' && token[len(token)-1] == '"': |
| 74 | schema = strings.ReplaceAll(token[1:len(token)-1], `""`, `"`) |
| 75 | case len(token) >= 2 && token[0] == '\'' && token[len(token)-1] == '\'': |
| 76 | schema = strings.ReplaceAll(token[1:len(token)-1], `''`, `'`) |
| 77 | default: |
| 78 | } |
| 79 | |
| 80 | if schema == "$user" { |
| 81 | return PGSearchPathItem{CurrentUser: true}, true |
| 82 | } |
| 83 | if isPGSystemPath(schema) { |
| 84 | return PGSearchPathItem{}, false |
| 85 | } |
| 86 | if schema == "" { |
| 87 | return PGSearchPathItem{}, false |
| 88 | } |
| 89 | return PGSearchPathItem{Schema: schema}, true |
| 90 | } |
| 91 | |
| 92 | func splitPGSearchPath(searchPath string) []string { |
| 93 | var parts []string |
no test coverage detected