Skip to content

Schultzer/ecto_qlc

Repository files navigation

Ecto QLC

Have you ever wondered if you could just write one Ecto query and use it both for an SQL database and Erlang's ETS, DETS or Mnesia?

Whether you are doing early prototyping or looking for an easy way to do pass-through cache, let Ecto do the heavy lifting for you, with one schema and multiple backends!

Installation

If available in Hex, the package can be installed by adding ecto_qlc to your list of dependencies in mix.exs:

def deps do
  [
    {:ecto_qlc, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ecto_qlc.

Limitations

The following are the current limitations. Most of these can be implemented and others might not even make sense to implement, like placeholders.

  • Subqueries are only supported without parent_as since that would require implementation of a query planner.
  • Combinations are not supported, but could be supported in a similar way as suqueries.
  • Windows are not supported.
  • Joins are limited to merge_join or nested_join, the qual: :left, :right, :inner, and etc will not affect the result.
  • CTE are not supported.
  • Query locks are only supported in the mnesia adapter, and only read, write or sticky_write. global locks are not supported.
  • Placeholders are not supported.
  • On_conflict is not supported.
  • Fragments are not supported in select and has limited support in where clauses where the string can only contain valid Erlang code.
  • Queries are not cached
  • No automatic clustering

Examples

Can be found under the examples directory.

Prior Arts

Most of the inspiration for this adapter comes from Ecto SQL and Etso.

Below is a non-exhaustive list of similar projects:

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

QLC-based adapters and database migrations for Ecto

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages