Skip to content

Commit

Permalink
feat: missing filter builder functions
Browse files Browse the repository at this point in the history
also implement a custom and simpler DSL
to represent conditions to be used in
`any_of`, `all_of` functions

renamed:
- `and/2` to `all_of/2`
- `or/2` to `any_of/2`
- `in/2` to `within/2`
- `not/3` to `negate/3`

to avoid conflict with [Kernel](https://hexdocs.pm/elixir/Kernel.html)
  • Loading branch information
zoedsoupe committed Dec 31, 2024
1 parent e22c90b commit a78312b
Show file tree
Hide file tree
Showing 6 changed files with 417 additions and 93 deletions.
2 changes: 1 addition & 1 deletion lib/supabase/postgrest.ex
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ defmodule Supabase.PostgREST do

## Filter Builder

for {fun, arity} <- FilterBuilder.__info__(:functions) do
for {fun, arity} <- FilterBuilder.__info__(:functions), fun != :process_condition do
1..arity
|> Enum.map(&Macro.var(:"arg_#{&1}", QueryBuilder))
|> then(fn args ->
Expand Down
1 change: 1 addition & 0 deletions lib/supabase/postgrest/builder.ex
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ defmodule Supabase.PostgREST.Builder do
@doc "Creates a new `#{__MODULE__}` instance"
def new(%Client{} = client, relation: relation) do
%__MODULE__{
client: client,
schema: client.db.schema,
method: :get,
params: %{},
Expand Down
Loading

0 comments on commit a78312b

Please sign in to comment.