示例#1
0
        public ColumnSlice <N, V> getColumns <N, V>(string keyspace, Object columnFamily, Object key, N[] columnNames)
        {
            client.set_keyspace(keyspace);
            byte[]       binaryKey = key.ToByteArray();
            ColumnParent cp        = new ColumnParent()
            {
                Column_family = columnFamily.ToString()
            };
            SlicePredicate sp = new SlicePredicate();

            sp.Column_names = columnNames.ToByteArrayListFromCollection <N>();
            var result = ThriftUtility.ToNColumnList <N, V>(client.get_slice(binaryKey, cp, sp, consistencyLevel));
            ColumnSlice <N, V> cslice = new ColumnSlice <N, V>();

            cslice.Columns = result;
            return(cslice);
        }
示例#2
0
        public static Rows <K, N, V> ToRowsFromSliceQuery <K, N, V>(Dictionary <byte[], List <ColumnOrSuperColumn> > results)
        {
            Rows <K, N, V> rows = new Rows <K, N, V>();

            rows.rowsList = new List <Row <K, N, V> >();

            foreach (KeyValuePair <byte[], List <ColumnOrSuperColumn> > entry in results)
            {
                ColumnSlice <N, V> cs = new ColumnSlice <N, V>();
                cs.Columns = ToNColumnList <N, V>(entry.Value);

                Row <K, N, V> row = new Row <K, N, V>();
                row.ColumnSlice = cs;
                row.Key         = (K)entry.Key.ToObjectFromByteArray(typeof(K));

                rows.rowsList.Add(row);
            }
            return(rows);
        }