florinpatrascu / bolt_sips

Neo4j driver for Elixir
Apache License 2.0
256 stars 49 forks source link
bolt driver elixir graph-database graphdb neo4j neo4j-driver
logo

Neo4j driver for Elixir.

Build Status Hex.pm Hexdocs.pm

Bolt.Sips is an Elixir driver for Neo4j, providing many useful features:

Notes:

Table of Contents

Installation

Available in Hex, the package can be added to your list of dependencies, in the: mix.exs:

def deps do
  [{:bolt_sips, "~> 2.0"}]
end

Basic usage

Provided you have access to a running Neo4j server, and a project where you just added the :bolt_sips dependency, run an iex session inside the project's folder, and once inside the shell, follow this simple step-by-step example.

Start an iex session:

Erlang/OTP 21 [erts-10.2.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]
Interactive Elixir (1.8.1) - press Ctrl+C to exit (type h() ENTER for help)

iex> {:ok, _neo} = Bolt.Sips.start_link(url: "bolt://neo4j:test@localhost")
{:ok, #PID<0.237.0>}

iex> conn = Bolt.Sips.conn()
#PID<0.242.0>

iex> Bolt.Sips.query!(conn, "return 1 as n") |>
...> Bolt.Sips.Response.first()
%{"n" => 1}

Please see the docs for more examples and details about this driver.

Testing

You'll need a running Neo4j server, for running the tests. Please verify that you do not store critical data on this server, as its contents will be wiped clean when the tests are running.

If you have docker available on your system, you can start an instance before running the test suite:

docker run --rm -p 7687:7687 -e 'NEO4J_AUTH=neo4j/test' neo4j:3.0.6

Neo4j versions used for test: 3.0, 3.1, 3.4, 3.5

mix test

For the stubs using boltkit, you will have to install Python 3.7 and run: pip install boltkit. After this you can run any tests tagged with :boltkit. Example:

mix test test/boltkit_test.exs --include boltkit

or:

mix test --only boltkit

Special thanks

Contributors

As reported by Github: contributions to master, excluding merge commits

Contributing

License

Copyright 2016-2020 the original author or authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.