RethinkDB.Ecto v0.6.1 RethinkDB.Ecto
Ecto adapter module for RethinkDB.
It uses :rethinkdb
to connect and communicate with a RethinkDB database.
The adapter tries to serialize SQL-like Ecto queries to the ReQL query
language in a performant manner. Lots of the query patterns are inspired
by the SQL to ReQL cheat-sheet1. If you want to know how a specific
function is implemented, look at the RethinkDB.Ecto.NormalizedQuery
module.
You can create and drop databases using mix ecto.create
and mix.ecto.drop
.
Migrations will work for creating tables and indexes. Field specifications are
not supported and will be ommited when executing the migration.
Additionaly, repositories using this adapter can run ReQL queries directly:
import RethinkDB.{Query, Lambda}
table("users")
|> has_fields(["first_name", "last_name"])
|> map(lambda & &1[:first_name] + " " + &1[:last_name])
|> MyApp.Repo.run()
Known Limitations
The adapter does not support connection pooling. All the queries are executed on the same connection. Due to the multiplex nature of RethinkDB connections, a single connection should do just fine for most use cases.
The data type of a primary key is a UUID :binary_id
. In order to work properly,
you must add the following attributes to your schema definitions:
@primary_key {:id, :binary_id, autogenerate: false}
@foreign_key_type :binary_id
You can set the :autogenerate
option to true
if you want to generate
primary keys on the client side.
RethinkDB does not support unique secondary indexes. Indexes can be created normaly using a migration file. When running migrations with unique indexes, you will get a warning. Nevertheless, the index will be created.
Summary
Functions
Callback implementation for Ecto.Adapter.autogenerate/1
Callback implementation for Ecto.Adapter.child_spec/2
Callback implementation for Ecto.Adapter.delete/4
Callback implementation for Ecto.Adapter.dumpers/2
Callback implementation for Ecto.Adapter.ensure_all_started/2
Callback implementation for Ecto.Adapter.execute/6
Callback implementation for Ecto.Adapter.Migration.execute_ddl/3
Callback implementation for Ecto.Adapter.insert/5
Callback implementation for Ecto.Adapter.insert_all/6
Callback implementation for Ecto.Adapter.loaders/2
Callback implementation for Ecto.Adapter.prepare/2
Callback implementation for Ecto.Adapter.Storage.storage_down/1
Callback implementation for Ecto.Adapter.Storage.storage_up/1
Callback implementation for Ecto.Adapter.Migration.supports_ddl_transaction?/0
Callback implementation for Ecto.Adapter.update/6
Functions
Callback implementation for Ecto.Adapter.autogenerate/1
.
Callback implementation for Ecto.Adapter.child_spec/2
.
Callback implementation for Ecto.Adapter.delete/4
.
Callback implementation for Ecto.Adapter.dumpers/2
.
Callback implementation for Ecto.Adapter.ensure_all_started/2
.
Callback implementation for Ecto.Adapter.execute/6
.
Callback implementation for Ecto.Adapter.Migration.execute_ddl/3
.
Callback implementation for Ecto.Adapter.insert/5
.
Callback implementation for Ecto.Adapter.insert_all/6
.
Callback implementation for Ecto.Adapter.loaders/2
.
Callback implementation for Ecto.Adapter.prepare/2
.
Callback implementation for Ecto.Adapter.Storage.storage_down/1
.
Callback implementation for Ecto.Adapter.Storage.storage_up/1
.
Callback implementation for Ecto.Adapter.Migration.supports_ddl_transaction?/0
.
Callback implementation for Ecto.Adapter.update/6
.