From 0690fb19152d035226efe247b88c7e600c882e1f Mon Sep 17 00:00:00 2001 From: Brian Underwood Date: Thu, 12 May 2016 21:32:45 +0100 Subject: [PATCH] Add detach_delete method --- CHANGELOG.md | 6 ++++++ lib/neo4j-core/query.rb | 6 +++++- lib/neo4j-core/query_clauses.rb | 4 ++++ lib/neo4j-core/version.rb | 2 +- spec/neo4j-core/unit/query_spec.rb | 20 ++++++++++++++++++++ 5 files changed, 36 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9240641c..8cf8c749 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. This file should follow the standards specified on [http://keepachangelog.com/] This project adheres to [Semantic Versioning](http://semver.org/). +## [6.1.4] - 05-12-2016 + +### Added + +- `detach_delete` method for `Query` API for `DETACH DELETE` clause introduced in Neo4j 2.3 + ## [6.1.3] - 04-28-2016 ### Fixed diff --git a/lib/neo4j-core/query.rb b/lib/neo4j-core/query.rb index 460d534f..49841e63 100644 --- a/lib/neo4j-core/query.rb +++ b/lib/neo4j-core/query.rb @@ -154,7 +154,11 @@ def inspect # DELETE clause # @return [Query] - METHODS = %w(start match optional_match using where create create_unique merge set on_create_set on_match_set remove unwind delete with return order skip limit) + # @method detach_delete *args + # DETACH DELETE clause + # @return [Query] + + METHODS = %w(start match optional_match using where create create_unique merge set on_create_set on_match_set remove unwind delete detach_delete with return order skip limit) BREAK_METHODS = %(with) CLAUSIFY_CLAUSE = proc { |method| const_get(method.to_s.split('_').map(&:capitalize).join + 'Clause') } diff --git a/lib/neo4j-core/query_clauses.rb b/lib/neo4j-core/query_clauses.rb index 45cd920e..67a912ec 100644 --- a/lib/neo4j-core/query_clauses.rb +++ b/lib/neo4j-core/query_clauses.rb @@ -479,6 +479,10 @@ def clause_color end end + class DetachDeleteClause < DeleteClause + KEYWORD = 'DETACH DELETE' + end + class OrderClause < Clause KEYWORD = 'ORDER BY' diff --git a/lib/neo4j-core/version.rb b/lib/neo4j-core/version.rb index cdecbceb..17b911cc 100644 --- a/lib/neo4j-core/version.rb +++ b/lib/neo4j-core/version.rb @@ -1,5 +1,5 @@ module Neo4j module Core - VERSION = '6.1.3' + VERSION = '6.1.4' end end diff --git a/spec/neo4j-core/unit/query_spec.rb b/spec/neo4j-core/unit/query_spec.rb index 325d470b..1bdf084d 100644 --- a/spec/neo4j-core/unit/query_spec.rb +++ b/spec/neo4j-core/unit/query_spec.rb @@ -710,6 +710,26 @@ def self.it_generates(cypher, params = {}) end end + # DETACH DELETE + + describe '#delete' do + describe ".detach_delete('n')" do + it_generates 'DETACH DELETE n' + end + + describe '.detach_delete(:n)' do + it_generates 'DETACH DELETE n' + end + + describe ".detach_delete('n', :o)" do + it_generates 'DETACH DELETE n, o' + end + + describe ".detach_delete(['n', :o])" do + it_generates 'DETACH DELETE n, o' + end + end + # SET describe '#set_props' do