View Source Ecto.DateTimeRange.Operators (Ecto DateTimeRange v2.0.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

contains(field, datetime)

(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()))