View Source Jsonb (phial v0.0.4)
A module for building Ecto queries with JSONB columns.
This module provides a macro json_query/4
to generate dynamic where clauses
for JSONB columns in an Ecto query.
Summary
Functions
Builds a dynamic where clause for JSONB columns in an Ecto query.
Functions
Builds a dynamic where clause for JSONB columns in an Ecto query.
Parameters
- qry: The initial query.
- col: The JSONB column to query.
- params: A keyword list of key-value pairs to match against the JSONB column.
- opts: A keyword list of options. Supports
:where_type
, which can be:where
or:or_where
. Defaults to:where
.
Examples
iex> import Ecto.Query
iex> query = from(p in Post)
iex> json_query(query, :metadata, [title: "Elixir", author: "José"], where_type: :where)
# Ecto query with JSONB where clauses