Represents the result of a SQL query execution.
Contains the columns, rows, and metadata about the query result.
Summary
Functions
Creates a new Result from columns and rows.
Returns a JSON-safe map representation of the result.
Types
@type t() :: %Lotus.Result{ columns: [String.t()], command: String.t() | nil, duration_ms: non_neg_integer() | nil, meta: map(), num_rows: non_neg_integer() | nil, rows: [[term()]] }
Functions
Creates a new Result from columns and rows.
Examples
iex> Lotus.Result.new(["name", "age"], [["John", 25], ["Jane", 30]])
%Lotus.Result{
columns: ["name", "age"],
rows: [["John", 25], ["Jane", 30]],
num_rows: 2,
duration_ms: nil,
command: nil,
meta: %{}
}
Returns a JSON-safe map representation of the result.
Normalizes all row values (UUID binaries, Dates, Decimals, etc.) using
Lotus.Normalizer so the output is safe for JSON encoding.