예제 #1
0
파일: main.go 프로젝트: tradia/gotable
func scan(c *table.Context, done chan *table.Call, zop bool,
	rowKey, colKey []byte, score int64, num int) {
	var err error
	var r table.ScanReply
	if zop {
		if done == nil {
			r, err = c.ZScanPivot(0, rowKey, colKey, score, true, true, num)
		} else {
			_, err = c.GoZScanPivot(0, rowKey, colKey, score, true, true, num, done)
		}
	} else {
		if done == nil {
			r, err = c.ScanPivot(0, rowKey, colKey, true, num)
		} else {
			_, err = c.GoScanPivot(0, rowKey, colKey, true, num, done)
		}
	}
	if err != nil {
		fmt.Printf("Scan failed: %s\n", err)
		os.Exit(1)
	}

	if *verbose != 0 && done == nil {
		for i := 0; i < len(r.Kvs); i++ {
			var one = r.Kvs[i]
			fmt.Printf("%02d) [%q\t%q]\t[%d\t%q]\n", i,
				r.RowKey, one.ColKey, one.Score, one.Value)
		}
	}
}