Project

aql

0.0
No commit activity in last 3 years
No release in over 3 years
The ArangoDB AQL AST. Intended for query generation.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.0.7
>= 3.0.3, ~> 3.0
~> 0.1.0
~> 0.0.5
 Project Readme

AQL

Build Status Dependency Status Code Climate

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

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.