Documentation
¶
Index ¶
- Constants
- func MapCSVHeaders(headers []string, fields []string) (map[string]any, error)
- func ParseKeyValuePairs(pairs []string, delimiter string) (map[string]any, error)
- func ParseURI(value string, semconvCompliant bool) (map[string]any, error)
- func ReadCSVRow(row string, delimiter rune, lazyQuotes bool) ([]string, error)
- func SplitString(input, delimiter string) ([]string, error)
Constants ¶
const ( // replace once conventions includes these AttributeURLUserInfo = "url.user_info" AttributeURLUsername = "url.username" AttributeURLPassword = "url.password" )
Variables ¶
This section is empty.
Functions ¶
func MapCSVHeaders ¶
MapCSVHeaders creates a map of headers[i] -> fields[i].
func ParseKeyValuePairs ¶
ParseKeyValuePairs will split each string in `pairs` on the `delimiter` into a key and value string that get added to a map and returned.
func ReadCSVRow ¶
ReadCSVRow reads a CSV row from the csv reader, returning the fields parsed from the line. We make the assumption that the payload we are reading is a single row, so we allow newline characters in fields. However, the csv package does not support newlines in a CSV field (it assumes rows are newline separated), so in order to support parsing newlines in a field, we need to stitch together the results of multiple Read calls.
func SplitString ¶
SplitString will split the input on the delimiter and return the resulting slice while respecting quotes. Outer quotes are stripped. Use in place of `strings.Split` when quotes need to be respected. Requires `delimiter` not be an empty string
Types ¶
This section is empty.