elixir-ecto / db_connection

Database connection behaviour
http://hexdocs.pm/db_connection/DBConnection.html
306 stars 113 forks source link

Introduce DBConnection.Sandbox #6

Closed fishcakez closed 8 years ago

fishcakez commented 8 years ago

DBConnection.Sandbox is equivalent to Ecto.Adapters.SQL.Sandbox though requires a different adapter API. A nice advantage of this implementation is that sandboxing does not change the pooling or transaction code and is a wrapper around a DBConnection module. It might be possible to combine it with an ownership based pool.

josevalim commented 8 years ago

It looks great. A couple questions:

  1. Does it mean the adapters themselves now need to implement the sandbox behaviour?
  2. Is Sandbox the proper name? I think sandbox is one possible use case for this, it feels like a Proxy or something of sorts.

The name Proxy will be specially relevant if we can implement it orthogonally to the given module (i.e. if 1 is false).