lib/grumlin/shortcuts/upserts.rb in grumlin-0.23.0 vs lib/grumlin/shortcuts/upserts.rb in grumlin-1.0.0.rc1
- old
+ new
@@ -1,28 +1,24 @@
# frozen_string_literal: true
-module Grumlin
- module Shortcuts
- module Upserts
- extend Grumlin::Shortcuts
+module Grumlin::Shortcuts::Upserts
+ extend Grumlin::Shortcuts
- shortcut :upsertV do |label, id, create_properties = {}, update_properties = {}|
- self.V(id)
- .fold
- .coalesce(
- __.unfold,
- __.addV(label).props(Cardinality.single, **create_properties.merge(T.id => id))
- ).props(Cardinality.single, **update_properties)
- end
+ shortcut :upsertV do |label, id, create_properties = {}, update_properties = {}|
+ self.V(id)
+ .fold
+ .coalesce(
+ __.unfold,
+ __.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 = {}|
- self.V(from)
- .outE(label).where(__.inV.hasId(to))
- .fold
- .coalesce(
- __.unfold,
- __.addE(label).from(__.V(from)).to(__.V(to)).props(**create_properties)
- ).props(**update_properties)
- end
- end
+ shortcut :upsertE do |label, from, to, create_properties = {}, update_properties = {}|
+ self.V(from)
+ .outE(label).where(__.inV.hasId(to))
+ .fold
+ .coalesce(
+ __.unfold,
+ __.addE(label).from(__.V(from)).to(__.V(to)).props(**create_properties)
+ ).props(**update_properties)
end
end