lib/grumlin/shortcuts/upserts.rb in grumlin-1.0.0.rc1 vs lib/grumlin/shortcuts/upserts.rb in grumlin-1.0.0.rc2
- old
+ new
@@ -11,14 +11,15 @@
__.addV(label).props(Cardinality.single, **create_properties.merge(T.id => id))
).props(Cardinality.single, **update_properties)
end
shortcut :upsertE do |label, from, to, create_properties = {}, update_properties = {}|
+ id = create_properties[T.id] || Grumlin.fake_uuid(from, label, to)
self.V(from)
.outE(label).where(__.inV.hasId(to))
.fold
.coalesce(
__.unfold,
- __.addE(label).from(__.V(from)).to(__.V(to)).props(**create_properties)
+ __.addE(label).from(__.V(from)).to(__.V(to)).props(**create_properties.merge(T.id => id))
).props(**update_properties)
end
end