// getLineType return data source type func getLineType(line string) int { if line == "" { return TYPE_EMPTY_LINE } if strutil.Head(line, 3) == "-- " { return TYPE_SEPARATOR } if strutil.Head(line, 2) == "+ " { if sliceutil.Contains(headers, strutil.Substr(line, 2, 99)) { return TYPE_HEADER } } if strutil.Head(line, 2) == " " && strings.Contains(line, ":") { return TYPE_RECORD } return TYPE_DATA }
// extractHeaderName return header name from data source func extractHeaderName(line string) string { return strutil.Substr(line, 2, 99) }