Builds the OData query parameters Exact Online understands.
The high level functions accept these options and translate them into the
$-prefixed parameters:
:select- a list of field names or a string:filter- an OData filter string, see the escaping helpers below:top- maximum number of records in the page:skip- number of records to skip:orderby- a list of field names or a string:expand- a list of navigation properties or a string:inlinecount- set to"allpages"to get a__countin the response:params- extra parameters merged as-is
$filter is picky about literals. Use the helpers instead of interpolating:
iex> Exact.Query.string("O'Brien & co")
"'O''Brien & co'"
iex> Exact.Query.guid("11111111-2222-3333-4444-555555555555")
"guid'11111111-2222-3333-4444-555555555555'"
iex> Exact.Query.datetime(~U[2026-01-31 12:00:00Z])
"datetime'2026-01-31T12:00:00'"
Summary
Functions
Formats a datetime literal for use in $filter.
Turns query options into a keyword list of request parameters.
Formats a GUID literal for use in $filter or a key predicate.
Escapes a string literal for use in $filter.
Functions
@spec datetime(DateTime.t() | NaiveDateTime.t() | Date.t()) :: String.t()
Formats a datetime literal for use in $filter.
Exact Online expects a naive, second precision timestamp without a zone suffix, so the value is converted to UTC and truncated.
Turns query options into a keyword list of request parameters.
Unknown options are ignored so the same option list can be passed straight through from a resource function.
iex> Exact.Query.encode(select: ["ID", "Name"], top: 10)
[{:"$select", "ID,Name"}, {:"$top", 10}]
Formats a GUID literal for use in $filter or a key predicate.
Escapes a string literal for use in $filter.
Single quotes are doubled, which is how OData escapes them.