ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - whatyouhide/xandra: Fast, simple, and robust Cassandra/ScyllaDB driver for Elixir.
Fast, simple, and robust Cassandra/ScyllaDB driver for Elixir. - whatyouhide/xandra
Visit Site

GitHub - whatyouhide/xandra: Fast, simple, and robust Cassandra/ScyllaDB driver for Elixir.

GitHub - whatyouhide/xandra: Fast, simple, and robust Cassandra/ScyllaDB driver for Elixir.

Xandra

hex.pm badge Documentation badge CI Hex.pm

Fast and robust Cassandra driver for Elixir.

Cover image

Xandra is a Cassandra driver built natively in Elixir and focused on speed, simplicity, and robustness. This driver works exclusively with the Cassandra Query Language v3 (CQL3) and native protocol v3, v4, and v5.

Features

  • 🎱 Connection pooling with automatic reconnections
  • 🌯 Prepared queries (with local cache of prepared queries on a per-connection basis) and batch queries
  • 📃 Page streaming
  • 🗜️ LZ4 compression
  • 👩‍👩‍👧‍👧 Clustering with support for autodiscovery of nodes in the cluster
  • 🔁 Customizable retry strategies for failed queries
  • 👩‍💻 User-defined types
  • 🔑 Authentication
  • 🔐 SSL encryption

See the documentation for detailed explanation of how the supported features work.

Installation

Add the :xandra dependency to your mix.exs file:

defp deps do
  [
    {:xandra, "~> 0.19"}
  ]
end

Then, run mix deps.get in your shell to fetch the new dependency.

Overview

The documentation is available on HexDocs.

Connections or pool of connections can be started with Xandra.start_link/1:

{:ok, conn} = Xandra.start_link(nodes: ["127.0.0.1:9042"])

This connection can be used to perform all operations against the Cassandra server. Executing simple queries looks like this:

statement = "INSERT INTO users (name, postcode) VALUES ('Priam', 67100)"
{:ok, %Xandra.Void{}} = Xandra.execute(conn, statement, _params = [])

Preparing and executing a query:

with {:ok, prepared} <- Xandra.prepare(conn, "SELECT * FROM users WHERE name = ?"),
     {:ok, %Xandra.Page{}} <- Xandra.execute(conn, prepared, [_name = "Priam"]),
     do: Enum.to_list(page)

Xandra supports streaming pages:

prepared = Xandra.prepare!(conn, "SELECT * FROM subscriptions WHERE topic = :topic")
page_stream = Xandra.stream_pages!(conn, prepared, _params = [], page_size: 1_000)

# This is going to execute the prepared query every time a new page is needed:
page_stream
|> Enum.take(10)
|> Enum.each(fn page -> IO.puts("Got a bunch of rows: #{inspect(Enum.to_list(page))}") end)

Scylla support

Xandra supports Scylla (version 2.x to 5.x) without the need to do anything in particular.

License

Xandra is released under the ISC license, see the LICENSE file.

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory