View Source Ecto.DateTimeRange.Operators (Ecto DateTimeRange v1.3.0)

Provides operators for querying against ranges in PostgreSQL.

Usage

import Ecto.Query
import Ecto.DateTimeRange.Operators

now = DateTime.utc_now()
from(thing in Thing, where: contains(thing.during, ^now))

Summary

Functions

Filter by rows where the given datetime falls within the range.

Functions

Link to this macro

contains(field, datetime)

View Source (macro)

Filter by rows where the given datetime falls within the range.

Examples

from(thing in Thing, where: contains(thing.during_utc, ^DateTime.utc_now()))