Esempio n. 1
0
func fromMapStr(data map[string]string) thrift.TMap {

	var m thrift.TMap
	if data != nil {
		m = thrift.NewTMap(thrift.STRING, thrift.STRING, len(data))
		for k, v := range data {
			m.Set(Hbase.Text(k), Hbase.Text(v))
		}
	}

	return m
}
Esempio n. 2
0
func toColumnsMap(hbaseColumns thrift.TMap) map[string]*ColumnDescriptor {
	if hbaseColumns == nil {
		return nil
	}

	l := hbaseColumns.Len()
	columns := make(map[string]*ColumnDescriptor, l)
	//fmt.Println("KeyType", hbaseColumns.KeyType())
	//fmt.Println("ValueType", hbaseColumns.ValueType())
	//fmt.Println("len", l)

	keys := hbaseColumns.Keys()
	for i := 0; i < l; i++ {
		key := keys[i]
		value, ok := hbaseColumns.Get(key)

		if !ok {
			continue
		}

		column := toColumn(value.(*Hbase.ColumnDescriptor))
		columns[column.Name] = column
	}

	return columns
}