Gluex

Elixir bindings for the GlueSQL Rust engine, independent of Ecto.

The Ecto adapter will live in a separate ecto_gluex package.

Usage

storage = Gluex.Storages.Memory.new()
database = Gluex.new(storage)
Gluex.query(database, "CREATE TABLE users (id INT, name TEXT)")
Gluex.query(database, "INSERT INTO users VALUES (1, 'Jan')")
Gluex.query(database, "SELECT * FROM users")
# [%{"type" => "SELECT", "columns" => ["id", "name"],
# "rows" => [[1, "Jan"]]}]

Values are converted directly to BEAM terms by the Rustler NIF. The binding does not use JSON or Jason at the Elixir API boundary.

JSON storage

database = Gluex.new(Gluex.Storages.Json.new("priv/data"))
Gluex.query(database, "CREATE TABLE users (id INT, name TEXT)")
Gluex.query(database, "INSERT INTO users VALUES (1, 'Jan')")

This creates priv/data/users.jsonl and, for schemaful tables, the table schema file as well.