aboutsummaryrefslogtreecommitdiff
path: root/lib/boltex.ex
blob: a5b2bbfaa13a7ba41b8ef75f013feead6f332b19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
defmodule Boltex do
  @moduledoc """
  Elixir library for using the Neo4J Bolt Protocol.

  It supports de- and encoding of Boltex binaries and sending and receiving
  of data using the Bolt protocol.
  """
  alias Boltex.Bolt

  def test(host, port, query, params \\ %{}, auth \\ nil) do
    {:ok, p}   = :gen_tcp.connect host, port, [active: false, mode: :binary, packet: :raw]

    :ok        = Bolt.handshake :gen_tcp, p
    :ok        = Bolt.init :gen_tcp, p, auth

    Bolt.run_statement(:gen_tcp, p, query)
  end

end