Skip to content

Commit

Permalink
Add detach_delete method
Browse files Browse the repository at this point in the history
  • Loading branch information
cheerfulstoic committed May 12, 2016
1 parent 5856c7a commit 0690fb1
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion lib/neo4j-core/query.rb
Expand Up @@ -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') }
Expand Down
4 changes: 4 additions & 0 deletions lib/neo4j-core/query_clauses.rb
Expand Up @@ -479,6 +479,10 @@ def clause_color
end
end

class DetachDeleteClause < DeleteClause
KEYWORD = 'DETACH DELETE'
end

class OrderClause < Clause
KEYWORD = 'ORDER BY'

Expand Down
2 changes: 1 addition & 1 deletion lib/neo4j-core/version.rb
@@ -1,5 +1,5 @@
module Neo4j
module Core
VERSION = '6.1.3'
VERSION = '6.1.4'
end
end
20 changes: 20 additions & 0 deletions spec/neo4j-core/unit/query_spec.rb
Expand Up @@ -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
Expand Down

0 comments on commit 0690fb1

Please sign in to comment.