是否可以在gremlin中为整数类型保存一个空值 [英] Is it possible to save an empty value for an integer type in gremlin
问题描述
g.V(123).property('myProperty', myproperty? myProperty: null)
这里myProperty
是整数类型,我希望为"myProperty"保存一个空值.
Here myProperty
is of integer type and I wish to save an empty value for 'myProperty'.
我知道不支持null.是否有另一种方法可以达到相同目的? (我也无法将值另存为0)
I know null is not supported. Is there another alternative to achieve the same? (I can't save the value as 0 either)
推荐答案
由于TinkerPop(Integer.MIN_VALUE之类的东西?或者,如果您使用的图形没有显式架构,则可以将其设置为非整数值,例如"null"字符串?我真的没有想到其他解决方法.
As there is no notion of null
in TinkerPop (for now) I'm afraid that you either have to remove the property or define some sort of constant to represent it. You say that you can't use "zero" but perhaps you could use something like Integer.MIN_VALUE
or something? Or, if you are using a graph that doesn't have an explicit schema you could set it to a non-integer value like a "null" string? I can't reall think of any other workarounds.
这篇关于是否可以在gremlin中为整数类型保存一个空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!