lib/neo4j/active_rel/persistence.rb in neo4j-6.0.9 vs lib/neo4j/active_rel/persistence.rb in neo4j-6.1.0
- old
+ new
@@ -34,9 +34,17 @@
def save!(*args)
save(*args) or fail(RelInvalidError, inspect) # rubocop:disable Style/AndOr
end
+ # Increments concurrently a numeric attribute by a centain amount
+ # @param [Symbol, String] name of the attribute to increment
+ # @param [Integer, Float] amount to increment
+ def concurrent_increment!(attribute, by = 1)
+ query_rel = Neo4j::Session.query.match('()-[n]-()').where(n: {neo_id: neo_id})
+ increment_by_query! query_rel, attribute, by
+ end
+
def create_model
validate_node_classes!
rel = _create_rel
return self unless rel.respond_to?(:props)
init_on_load(rel, from_node, to_node, @rel_type)