Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 1018 Bytes

README.md

File metadata and controls

37 lines (27 loc) · 1018 Bytes

ecto_pg_extras

A collection of custom functions for PostgreSQL features in Ecto

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

Usage

Import ecto_pg_extras in any module where you want access to the custom functions for use with Ecto queries.

import EctoPgExtras

Then use any of the functions as part of a query as you would anything else defined in Ecto.Query.API. For example, here is the coalesce function in action:

from(posts in Posts,
where: posts.id == 1,
select: {
  posts.title,
  coalesce(posts.description, posts.short_description, "N/A")
})

About

Hashrocket logo

EctoPgExtras is supported by the team at Hashrocket, a multidisciplinary design & development consultancy. If you'd like to work with us or join our team, don't hesitate to get in touch.