MarcoPolo: Elixir with OrientDB
OrientDB supports a number of application programming interfaces, natively through the JVM and externally through Java wrappers and the Binary Protocol. In the event that you need or would prefer to develop your OrientDB application Erlang VM language Elixir, you can do so through the driver MarcoPolo.
For more information on the MarcoPolo Elixir driver, see the project documentation.
Getting MarcoPolo
In order to use MarcoPolo in your Elixir application, you first need to register it as a dependency for the Mix build tool. To do so, edit the mix.exs
file in the project root directory and add MarcoPolo as a dependency to the deps
function.
# Project Dependencies
def deps do
[{:marco_polo, "~> 0.1"}]
end
With this line added, Mix now knows that your application requires MarcoPolo. To retrieve and compile the package, use Mix:
$mix deps.get
$mix deps.compile
When you run the deps.get
command, Mix calls the Hex package manager to fetch the MarcoPolo package and its dependencies. The second command then compiles these packages for use with your application. You can see that the dependencies were installed without error by calling Mix again with the deps
argument:
$ mix deps
...
* marco_polo 0.2.2 (Hex package) (mix)
locked at 0.2.2 (marco_polo) 40x47150
ok
Using MarcoPolo
Once you have registered MarcoPolo as a dependency with Mix you can begin to use it in developing your Elixir application.
@doc """ Connects to OrientDB Server """
def connect_orientdb_server(user, passwd) do
{:ok, conn} = MarcoPolo.start_link(
user: user, password: passwd, connection: :server)
end