Moebius.Transformer

The results that come back from Postgrex are in a bit of a convoluted form with string key maps that aren’t terribly useful. This module restructures the results.

Summary

Functions

String keys are a pain, atom maps are nicer

We want a map as a result, so let’s make one

Returns the first result from a Postgrex.Result

Coerce a large result set into an array of atom-keyed maps

Coerces a Postgrex.Result into a single atom-keyed map

Pushes the columns and rows together

Functions

coerce_atoms(string_key_map)

String keys are a pain, atom maps are nicer

create_map_from_list(list)

We want a map as a result, so let’s make one

get_first_result(res)

Returns the first result from a Postgrex.Result

to_list(arg)

Coerce a large result set into an array of atom-keyed maps

to_single(arg)

Coerces a Postgrex.Result into a single atom-keyed map

zip_columns_and_row(arg)

Pushes the columns and rows together