這是一個(gè)使用go操作hbase的行為。
分析scan行為
如何使用scan看下面這個(gè)例子,偽代碼如下:
func scan(phone string, start time.Time, end time.Time) ([]Loc, error) { ... client := hbase.NewClient(zks, "/hbase") client.SetLogLevel("DEBUG") scan := client.Scan(table) scan.StartRow = []byte(phone + strconv.Itoa(int(end.Unix()))) scan.StopRow = []byte(phone + strconv.Itoa(int(start.Unix()))) var locs []Loc scan.Map(func(ret *hbase.ResultRow) { var loc Loc for _, v := range ret.Columns { switch v.ColumnName { case "lbs:phone": loc.Phone = v.Value.String() case "lbs:lat": loc.Lat = v.Value.String() &n