Supra (Supra v0.2.0)

Documentation for Supra.

Summary

Functions

Returns the number of rows in queryable

Limits queryable to one result and returns that result

Returns query as a string with all parameters formatted in the specified style. Styles are rendered via IO.ANSI which will only render stylized text if it thinks the output device can show them.

Applies limit to queryable

Types

Link to this type

change(type)

@type change(type) :: Ecto.Changeset.t(type)
Link to this type

result(type)

@type result(type) :: {:ok, type} | {:error, Ecto.Changeset.t(type)}
Link to this type

result(ok_t, error_t)

@type result(ok_t, error_t) :: {:ok, ok_t} | {:error, Ecto.Changeset.t(error_t)}

Functions

Link to this function

count(queryable, list)

@spec count(Ecto.Queryable.t(), [{:repo, Ecto.Repo.t()}]) :: non_neg_integer()

Returns the number of rows in queryable

Link to this function

first(queryable, list)

@spec first(Ecto.Queryable.t(), [{:repo, Ecto.Repo.t()}]) :: Ecto.Schema.t() | nil

Limits queryable to one result and returns that result

Link to this function

format(query, style \\ :inverse, list)

@spec format(Ecto.Queryable.t(), Supra.Format.style(), [{:repo, Ecto.Repo.t()}]) ::
  binary()

Returns query as a string with all parameters formatted in the specified style. Styles are rendered via IO.ANSI which will only render stylized text if it thinks the output device can show them.

  • :bright renders parameters in brighter text, which is the most subtle of all the supported styles and may be hard to differentiate.
  • :color renders parameters in different colors depending on their data types via IO.ANSI.syntax_colors/0.
  • :inverse (the default) renders parameters with an inverse background. This is quite visible and also compatible when some other code such as a logger is colorizing the query.
  • :underline is a bit more subtle than :inverse but more visible than :bright.
Link to this function

limit(queryable, count)

Applies limit to queryable