Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 54 lines (42 sloc) 1.316 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
using System;
using FluentCassandra.Types;

namespace FluentCassandra.Operations
{
public class GetColumn : ColumnFamilyOperation<FluentColumn>
{
/*
* ColumnOrSuperColumn get(keyspace, key, column_path, consistency_level)
*/

public CassandraObject Key { get; private set; }

public CassandraObject SuperColumnName { get; private set; }

public CassandraObject ColumnName { get; private set; }

public override FluentColumn Execute()
{
var schema = ColumnFamily.GetSchema();

var path = new CassandraColumnPath {
ColumnFamily = ColumnFamily.FamilyName
};

if (SuperColumnName != null)
path.SuperColumn = SuperColumnName.GetValue(schema.SuperColumnNameType) as CassandraObject;

if (ColumnName != null)
path.Column = ColumnName.GetValue(schema.ColumnNameType) as CassandraObject;

var output = Session.GetClient().get(
Key,
path,
Session.ReadConsistency
);

return (FluentColumn)Helper.ConvertToFluentBaseColumn(output, schema);
}

public GetColumn(CassandraObject key, CassandraObject superColumnName, CassandraObject columnName)
{
Key = key;
SuperColumnName = superColumnName;
ColumnName = columnName;
}

public GetColumn(CassandraObject key, CassandraObject columnName)
{
Key = key;
ColumnName = columnName;
}
}
}
Something went wrong with that request. Please try again.