Beispiel #1
0
// 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
}
Beispiel #2
0
// extractHeaderName return header name from data source
func extractHeaderName(line string) string {
	return strutil.Substr(line, 2, 99)
}