Packages
exandra
0.16.0
1.1.0
1.0.0
0.16.0
0.15.0
0.14.0
0.13.0
0.12.0
0.11.0
0.10.3
0.10.2
0.10.1
0.10.1-rc.5
0.10.0
0.10.0-rc.5
0.10.0-rc.4
0.10.0-rc.3
0.10.0-rc.2
0.10.0-rc.1
0.9.1
0.9.0
0.8.1
0.8.0
0.7.5
0.6.5
0.6.4
0.6.3
0.6.2
0.6.1
0.6.0
0.5.1
0.5.0
0.4.1
0.4.0
0.3.1
0.3.0
0.2.1
0.2.0
0.1.16
0.1.15
0.1.14
0.1.13
0.1.12
0.1.11
0.1.10
Exandra is an Elixir library that brings the power of Scylla/Cassandra to Ecto.
Current section
Files
Jump to
Current section
Files
lib/exandra/batch.ex
defmodule Exandra.Batch do
@moduledoc """
A struct that represents a batch of queries to be executed in a single
request to Cassandra/Scylla.
This is essentially a wrapper around `Xandra.Batch`, but you should not
use `Xandra.Batch` if working with Exandra.
`Exandra.Batch` contains a single field, `:queries`, which is a list of
tuples in the form `{query, params}`.
## Usage
To execute a batch of queries through Exandra, you can use the
`Exandra.execute_batch/3`.
batch = %Exandra.Batch{
queries: [
{"INSERT INTO users (email) VALUES (?)", ["jeff@example.com"]},
{"INSERT INTO users (email) VALUES (?)", ["britta@example.com"]}
]
}
Exandra.execute_batch(MyApp.Repo, batch)
"""
@type t() :: %__MODULE__{queries: [{String.t(), list()}]}
@enforce_keys [:queries]
defstruct [:queries]
end