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

Provides operators for querying against ranges in PostgreSQL.

usage

Usage

import Ecto.Query
import Ecto.DateTimeRange.Operators

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

Link to this section Summary

Functions

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

Link to this section Functions

Link to this macro

contains(field, datetime)

View Source (macro)

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

examples

Examples

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