Postgrex.Result

Result struct returned from any successful query. Its fields are:

  • command - An atom of the query command, for example: :select or

    `:insert`;
  • columns - The column names;
  • rows - The result set. A list of tuples, each tuple corresponding to a

    row, each element in the tuple corresponds to a column;
  • num_rows - The number of fetched or affected rows;
  • decoders - List of anonymous functions to decode each column;

Summary

Types

t :: %Postgrex.Result{command: atom, columns: [String.t] | nil, rows: [[term] | term] | nil, num_rows: integer, decoders: [(term -> term)] | nil}

Functions

decode(result_set, mapper \\ fn x -> x end)

Specs

decode(t, ([term] -> term)) :: t

Decodes a result set.

It is a no-op if the result was already decoded.

A mapper function can be given to further process each row, in no specific order.