简体   繁体   English

如何在Cayley DB中插入日期数据类型?

[英]How to insert date datatype in cayley db?

I need to insert date value in a node. 我需要在节点中插入日期值。 Something like creation date for another node. 类似于其他节点的创建日期 But in cayley, we could only insert string datatype. 但是在cayley中,我们只能插入字符串数据类型。 I may use the toString() and save the date as string. 我可以使用toString()并将日期另存为字符串。 But, while retrieving, I need to filter by giving a date range. 但是,在检索时,我需要通过指定日期范围来进行过滤。 How would I possibly do this? 我应该怎么做?

BTW, I'm using gremlin programming language to retrieve. 顺便说一句,我正在使用gremlin编程语言进行检索。

Cayley recognizes schema.org data types, thus you can use DateTime type for your values: Cayley可以识别schema.org数据类型,因此可以将DateTime类型用作值:

"1990-07-04T17:25:41Z"^^<http://schema.org/DateTime>

Later you can use Gizmo to query date ranges: 稍后,您可以使用Gizmo查询日期范围:

var d = new Date(1900, 1, 1);
g.V().Has("<birthDate>", gt(d)).All()

Perhaps you can store the dates as unix time-stamps? 也许您可以将日期存储为unix时间戳? That way, even if you do a string comparison you'll get the correct results. 这样,即使您进行字符串比较,您也会获得正确的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM