TestData: Support labels in CSV content name (#61337)

Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
This commit is contained in:
Ryan McKinley
2023-05-26 19:36:43 +03:00
committed by GitHub
co-authored by Leon Sorokin
parent 4aa207ed83
commit effe21fb65
4 changed files with 93 additions and 1 deletions
+10
View File
@@ -147,6 +147,16 @@ func LoadCsvContent(ioReader io.Reader, name string) (*data.Frame, error) {
}
}
// Check for labels in the name
idx := strings.Index(fieldName, "{")
if idx >= 0 {
labels := parseLabelsString(fieldName[idx:], fieldIndex) // _ := data.LabelsFromString(fieldName[idx:])
if len(labels) > 0 {
field.Labels = labels
fieldName = fieldName[:idx]
}
}
field.Name = fieldName
fields = append(fields, field)
if field.Len() > longest {