AQL
Generator for the ArangoDB Query Language AQL in Ruby. It is used as a backend for axiom-arango-adapter.
Using AQL
There is currently no stable public API.
Installation
Install the gem aql
via your preferred method.
Examples
This gem does not have a public API. Please do not use it as a way to generate AQL statements by hand - this gem is not intended for this purpose. Instead write a library that uses this gem to generate AQL. Just to make it easier for you to get into the code, here is an example on how to generate a simple AQL statement:
require 'aql'
include AQL
person = Node::Name.new('person')
firstname = Node::Name.new('firstname')
lastname = Node::Name.new('lastname')
person_firstname = Node::Attribute.new(person, firstname)
node = Node::Operation::For.new(
person,
Node::Name.new('people'),
Node::Block.new(
[
Node::Operation::Unary::Filter.new(
Node::Operator::Binary::Equality.new(person_firstname, Node::Literal::Primitive::String.new('Markus'))
),
Node::Operation::Unary::Return.new(
Node::Literal::Primitive::Composed::Document.new([
Node::Literal::Composed::Document::Attribute.new(
person_firstname,
Node::Attribute.new(person, Node::Name.new('lastname'))
)
])
)
]
)
)
puts node.aql
#=> "FOR `person` IN `people` FILTER (`person`.`firstname` == "Markus") RETURN {`person`.`firstname`: `person`.`lastname`}"
Credits
- Markus Schirp (mbj) Author
- triAGENS For sponsoring this work!
Contributing
- Fork the project.
- Make your feature addition or bug fix.
- Add tests for it. This is important so I don't break it in a future version unintentionally.
- Commit, do not mess with Rakefile or version (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
- Send me a pull request. Bonus points for topic branches.
License
This gem is published under the MIT license. See LICENSE file.