bluzky

bluzky

A small library to build Ecto query from map

I have just released a small library that help to build query from a map with structure similar to Mongo DB filter like this:

Filtery.apply(Post, %{name: {:like, "elixir"}, is_draft: false, tags: {:has, "ecto"} })

Here is the repo:

https://github.com/bluzky/filtery

It’s quite simple and supports filtering on a single table only.
It supports basic operators eq, :gt, :gte, :in, :lt, :lte, :ne, :nin, :and, :or and some other helpful operators. And you can define your own operators too.

Please try and leave your feedback. Thank you.

Update v0.2.0

I have added a special operator ref to join multiple table

query = Filtery.apply(Post, %{comments: {:ref, %{
                                    approved: true,
                                    content: {:like, "filtery"}
                                 }}})

comments field must be the association name in your Post schema

First Post!

subbu

subbu

This is neat. It will work well for simple use cases. Its also good in way that you can build filters progressively as its a map. But its use will be limited as most production use-cases will involve multi-table filtering.

Most Liked

mathieuprog

mathieuprog

This looks similar to my library QueryBuilder :grin:
It’s possible to have joins.

Possible to make a query out of a keyword list with QueryBuilder.from_list/2.

marciol

marciol

It’s really nice to have ways of building queries using a more data-driven approach. It’s really awesome

bluzky

bluzky

I have added new operator for querying join table. Please check update above.

Where Next?

Popular in Announcing Top

Crowdhailer
Experimenting with this code. OK.try do user <- fetch_user(1) cart <- fetch_cart(1) order = checkout(cart, user) save_orde...
New
OvermindDL1
Been making an MLElixir thing (not released yet…) for fun in spare time in the past day. I’m just trying to see how much I can get an ML...
132 14410 106
New
Azolo
Hey everyone, I just released WebSockex which is a Elixir WebSocket client. WebSockex strives to work as a OTP special process, be RFC6...
New
pkrawat1
Hey guyz We at @aviabird are working on a payment library in elixir/phoenix. We are targeting March 2018 to add 56 Gateways to it. Have...
New
mbuhot
Leverage Open Api 3.0 (Swagger) to document, test, validate and explore your Plug and Phoenix APIs. Generate and serve a JSON Open API ...
New
tmbb
I’ve decided to create this topic to discuss optimization possibilities for something like Phoenix LiveView. I’ve created this topic unde...
144 10847 141
New
mplatts
With HEEX released we decided to start a components library using Tailwind CSS - check it out here: Petal Components. We also have a boi...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 131117 1222
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New

We're in Beta

About us Mission Statement