PgRest.Function.Return (PgRest v0.2.0)

Copy Markdown View Source

What a PgRest.Function returns.

  • kind - :void, :scalar or :composite. A function with any OUT, INOUT or TABLE parameter is :composite, even with a single one.
  • set? - whether it returns a set (SETOF, TABLE)
  • type - the return type's format_type text: record for several OUT/TABLE columns, the column's own type for a single OUT/INOUT parameter (integer for single_out_param(num int, OUT num_plus_one int), still :composite with that one column), schema.table for a declared resource return
  • columns - {name, type} of the composite type's attributes or of the OUT/INOUT/TABLE parameters. A bare record has none, so no select or filter applies to it. A declared resource return has none either: its resource is the source of truth.
  • categories - pg_type.typcategory of each column, by name ("S" string, "E" enum, ...), when introspected; a string or enum column filters with a bare bind, as a resource column does
  • resource - the registered resource whose table is the composite type

Summary

Types

t()

@type t() :: %PgRest.Function.Return{
  categories: %{required(String.t()) => String.t()},
  columns: [{String.t(), String.t()}],
  kind: :void | :scalar | :composite,
  resource: module() | nil,
  set?: boolean(),
  type: String.t()
}