예제 #1
0
func NewLTSVScanner(keys []string, r io.Reader) *LTSVScanner {
	return &LTSVScanner{
		OutputDelimiter: "\t",
		keys:            keys,
		reader:          goltsv.NewReader(r),
	}
}
예제 #2
0
func (v *LTSView) Start() {
	reader := goltsv.NewReader(v.Reader)
	for {
		record, err := reader.Read()
		if err == io.EOF {
			break
		}
		if err != nil {
			continue
		}
		PrintSep(v.Writer)
		sortedKeys := SortKeys(record)
		for _, k := range sortedKeys {
			if _, ignore := v.Ikeys[k]; len(v.Ikeys) > 0 && ignore {
				continue
			}
			if _, show := v.Keys[k]; len(v.Keys) > 0 && !show {
				continue
			}
			PrintLine(v.Writer, k, record[k])
		}
	}
}