Company
Date Published
Author
Neo4j
Word count
1319
Language
English
Hacker News points
None

Summary

The Neo4j.rb gem provides two main classes for building Cypher queries: Neo4j::Core::Query and Neo4j::ActiveNode::Query::QueryProxy. QueryProxy is a convenience class that uses information from models to build queries, whereas Core::Query is more flexible but requires explicit syntax. The key to getting the most out of Neo4j.rb is understanding how to move between these two classes in different situations. Methods like `query` and `query_as` can be used to convert QueryProxy objects to Core::Query objects, while methods like `proxy_as` can be used to convert Core::Query objects back to QueryProxy objects. By leveraging these tools, developers can optimize their Cypher queries for performance and create more efficient code.