TestData: Support labels in CSV content name (#61337)
Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
This commit is contained in:
co-authored by
Leon Sorokin
parent
4aa207ed83
commit
effe21fb65
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user