ParsePgControldataOutput parses a pg_controldata output into a map of key-value pairs
(data string)
| 161 | |
| 162 | // ParsePgControldataOutput parses a pg_controldata output into a map of key-value pairs |
| 163 | func ParsePgControldataOutput(data string) PgControlData { |
| 164 | pairs := make(map[string]string) |
| 165 | lines := strings.Split(data, "\n") |
| 166 | for _, line := range lines { |
| 167 | key, value, done := strings.Cut(line, ":") |
| 168 | if !done { |
| 169 | continue |
| 170 | } |
| 171 | pairs[strings.TrimSpace(key)] = strings.TrimSpace(value) |
| 172 | } |
| 173 | return pairs |
| 174 | } |
| 175 | |
| 176 | // TODO(leonardoce): I believe that the code about the promotion token |
| 177 | // belongs to a different package |
no outgoing calls
no test coverage detected