AppendUnstructured trims and adds unvalidated pg_hba.conf lines to o. Empty lines and lines that are entirely control characters are omitted.
(hbas ...string)
| 224 | // AppendUnstructured trims and adds unvalidated pg_hba.conf lines to o. |
| 225 | // Empty lines and lines that are entirely control characters are omitted. |
| 226 | func (o *OrderedHBAs) AppendUnstructured(hbas ...string) { |
| 227 | for _, hba := range hbas { |
| 228 | hba = strings.TrimFunc(hba, func(r rune) bool { |
| 229 | // control characters, space, and backslash |
| 230 | return r > '~' || r < '!' || r == '\\' |
| 231 | }) |
| 232 | |
| 233 | // NOTE: Skipping "include" directives here is a security measure. |
| 234 | if len(hba) > 0 && !strings.HasPrefix(hba, "include") { |
| 235 | o.records = append(o.records, hba) |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | // AsStrings returns a copy of o as a slice. |
| 241 | func (o *OrderedHBAs) AsStrings() []string { |
no outgoing calls