Skip to content

hashrocket/ecto_pg_extras

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A collection of custom functions for PostgreSQL features in Ecto

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages