Squirrelix.Inference.Inferrer behaviour (Squirrelix v0.5.2)

Copy Markdown View Source

Behaviour for modules that infer SQL query parameters and returned columns.

Part of the supported public API for custom query sources. Prefer Squirrelix.Postgres.inferrer/1 when connecting to a live database.

Callbacks receive a Squirrelix.Query and must return either:

{:ok, [params: types, returns: columns]}
{:error, structured_error}

where types is a list of type atoms (see the Types guide) and columns is a list of maps with :name, :type, and :nullable? keys — the same shape as metadata-file entries.

The Mix task uses Squirrelix.Postgres.inferrer/1 when --infer is passed. See the Configuration guide for connection options.

Summary

Callbacks

infer(t)

@callback infer(Squirrelix.Query.t()) :: {:ok, keyword()} | {:error, struct()}