Cassandra.Ecto v0.5.1 Cassandra.Ecto

Ecto integration for Apache Cassandra.

Cassandra adapter implements 3 behaviours:

Every behaviour implementation stays in separate file with appropriate docs. Please view for more information:

Usage example

# In your config/config.exs file
config :my_app, Repo,
  keyspace: "my_keyspace"

# In your application code
defmodule Repo do
  use Ecto.Repo,
    otp_app: :my_app,
    adapter: Cassandra.Ecto
end

defmodule Post do
  use Ecto.Model

  @primary_key {:id, :binary_id, autogenerate: true}
  schema "posts" do
    field :title,    :string
    field :text,     :string
    field :tags,     {:array, :string}
    timestamps()
  end
end

defmodule Simple do
  import Ecto.Query

  def sample_query do
    query = from p in Post, where: "elixir" in p.tags
    Repo.all(query, allow_filtering: true)
  end
end

Available connection options

:nodes
:keyspace
:auth
:ssl
:protocol_version
:pool_max_size
:pool_min_size
:pool_cull_interval

By default nodes: [{"127.0.0.1", 9042}]

Please see CQErl connecting for other options information.

Summary

Functions

child_spec(repo, opts)

Returns the childspec that starts the adapter process.

Callback implementation for Ecto.Adapter.child_spec/2.

delete(repo, meta, fields, opts)

See Cassandra.Ecto.Adapter.delete/4.

dumpers(primitive, type)

See Cassandra.Ecto.Adapter.dumpers/2.

ensure_all_started(repo, type)

Ensure all applications necessary to run the adapter are started.

Callback implementation for Ecto.Adapter.ensure_all_started/2.

execute(repo, meta, query, params, preprocess, opts)

See Cassandra.Ecto.Adapter.execute/6.

execute_ddl(repo, command, opts)

See Cassandra.Ecto.Migration.execute_ddl/3.

insert(repo, meta, fields, on_conflict, returning, opts)

See Cassandra.Ecto.Adapter.insert/6.

insert_all(repo, meta, header, rows, on_conflict, returning, opts)

See Cassandra.Ecto.Adapter.insert_all/7.

loaders(primitive, type)

See Cassandra.Ecto.Adapter.loaders/2.

prepare(func, query)

See Cassandra.Ecto.Adapter.prepare/2.

query(repo, statement, values \\ [], opts \\ [])
stream(repo, meta, prepared, params, preprocess, opts)

See Cassandra.Ecto.Stream.stream/6.

supports_ddl_transaction?()

Checks if the adapter supports ddl transaction.

Callback implementation for Ecto.Adapter.Migration.supports_ddl_transaction?/0.

update(repo, meta, fields, filters, returning, opts)

See Cassandra.Ecto.Adapter.update/6.