Cardbox.Filter (Cardbox v0.1.0)

Copy Markdown View Source

A condition on a field that a record meets or not.

%{"field" => "status", "op" => "eq", "value" => "Done"}
%{"field" => "due", "op" => "within", "value" => "next_week"}
%{"field" => "owner", "op" => "eq", "value" => "me"}

The operators of a field are those of its type (Cardbox.Type.operators/1):

OperatorOfValue
eq, neqevery type but listsa value of the field
contains, not_contains, starts_with, ends_withtextsa text, without case
gt, gte, lt, ltenumbersa number
betweennumbers, dates[from, to], both included
before, after, on_or_before, on_or_afterdatesa day
withindatespast_week, past_month, past_year, next_week, next_month, next_year, this_week, this_month, this_year
in, not_ina select, a status, a persona list of values
in_groupa statustodo, doing or done, or a list of them
has_any, has_all, has_nonemulti-selects, relations, peoplea list of values
is_empty, is_not_emptyevery type that can be emptynone

A day is "2026-10-25", or a day said in words that is read when the query runs: today, tomorrow, yesterday, one_week_ago, one_week_from_now, one_month_ago, one_month_from_now. A saved view of "due within the next week" shows a different week each week.

A person is their id, or "me": the person who runs the query (the :me option of a query), so one shared view of "my tasks" shows each person theirs.

A choice is its id or its name. "Is not", "does not contain", "is none of" and "has none of" take the records with no value too, as a person means them.

Summary

Functions

The ranges of days that within takes.

The days said in words that a date filter takes.

Types

t()

@type t() :: %Cardbox.Filter{field: String.t(), op: atom(), value: term()}

Functions

ranges()

@spec ranges() :: [String.t()]

The ranges of days that within takes.

relative_days()

@spec relative_days() :: [String.t()]

The days said in words that a date filter takes.