axiom-arango-adapter

Build Status Dependency Status Code Climate

ArangoDB adapter for axiom.

Installation

Install the gem axiom-arango-adapter via your preferred method.

Examples

Setup a gateway and connect it to ArangDB:

require 'axiom-arango-adapter'
require 'logger'

# Connect to ArangoDB
database = Ashikawa::Core::Database.new('http://localhost:8529')

# Save some people in the database
collection = database['people']

[
  { :id => 1, :firstname => "Jon", :lastname => "Doe" },
  { :id => 2, :firstname => "Sue", :lastname => "Doe" }
].each do |document|
  collection.create(document)
end

# Some logger to see AQL
logger = Logger.new($stderr, :debug)

# Instantiating adapter
adapter = Axiom::Adapter::Arango::Adapter.new(database, logger)

# Setting up a base relation
header = Axiom::Relation::Header.coerce([[:id, Integer], [:firstname, String], [:lastname, String]])
base   = Axiom::Relation::Base.new(:people, header)

# Creating a gateway
gateway = adapter.gateway(base)

# Use the gateway with the examples from the axiom README, for example:
gateway.restrict { |r| r.firstname.eq("Sue") } # restricts to tuples where firstname is "Sue"

You can find more examples in the axiom README.

Fuzzer

Axiom has a fuzzer to assist checking the correctness of the adapter and datastore. To run the fuzzer execute the following:

bundle exec spec/fuzzer.rb

Make sure you run an ArangoDB instance on localhost at the default port!

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.