ExFattureincloud.Filter (ExFattureincloud v0.1.0)

Copy Markdown View Source

Immutable query builder compatible with the official Go/TypeScript filter helpers.

iex> alias ExFattureincloud.Filter
iex> Filter.where("name", :contains, "Rossi") |> Filter.and_where("active", :eq, true) |> Filter.build()
"(name contains 'Rossi' and active = true)"

Pass build/1 directly as q:; Req URL-encodes it once. nil becomes null, strings are quoted, booleans/numbers are unquoted. Apostrophes, backslashes and control characters in string literals are rejected: the provider documents no escaping contract for these values. Use a manually verified raw q if needed. Field availability depends on the selected endpoint.

Summary

Functions

Combines two filters with parenthesized AND.

Combines an existing filter and a new condition with AND.

Combines two filters with parenthesized OR.

Returns the unencoded query string.

Combines an existing filter and a new condition with OR.

Builds one condition. Operators are atoms (e.g. :eq) or official strings (e.g. =).

Types

t()

@type t() :: %ExFattureincloud.Filter{expression: String.t()}

value()

@type value() :: String.t() | number() | boolean() | nil

Functions

all(filter1, filter2)

@spec all(t(), t()) :: t()

Combines two filters with parenthesized AND.

and_where(left, field, op, value)

@spec and_where(t(), String.t(), atom() | String.t(), value()) :: t()

Combines an existing filter and a new condition with AND.

any(filter1, filter2)

@spec any(t(), t()) :: t()

Combines two filters with parenthesized OR.

build(filter)

@spec build(t()) :: String.t()

Returns the unencoded query string.

or_where(left, field, op, value)

@spec or_where(t(), String.t(), atom() | String.t(), value()) :: t()

Combines an existing filter and a new condition with OR.

where(field, operator, value)

@spec where(String.t(), atom() | String.t(), value()) :: t()

Builds one condition. Operators are atoms (e.g. :eq) or official strings (e.g. =).