如何使用 Datastax C# 驱动程序对 timeuuid 数据类型进行 CQL 查询中的“大于”或“小于”where 条件?
我在 Cassandra 中有一个表,用于存储按时间戳排序的 cookie 历史记录为 timeuuid:
CREATE TABLE cookie_history (
cookie_id text,
create_date timeuuid,
item_id text,
PRIMARY KEY ((cookie_id), create_date)
);
该表使用 C# 类映射,以便使用 Datastax C# Cassandra 驱动程序进行查询:
[Table("cookie_history")]
public class CookieHistoryDataEntry
{
[PartitionKey(1)]
[Column("cookie_id")]
public string CookieID;
[ClusteringKey(1)]
[Column("create_date")]
public Guid CreateDate;
[Column("item_id")]
public string ItemID;
}
对于给定的 cookie,我想要给定时间戳之后的所有项目。
var myTimeUuid = new Guid("5812e74d-ba49-11e3-8d27-27303e6a4831");
var table = session.GetTable<CookieHistoryDataEntry>();
var query = table.Where(x => x.CookieID == myCookieId
&& x.CreateDate > myTimeUuid);
但是这个 (x.CreateDate > myTimeUuid) 给了我一个编译时错误:
Operator '>' cannot be applied to operands of type 'System.Guid' and 'System.Guid'