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 (or %{type: atom, name: optional_string}
maps — see the Types guide) and columns is a list of %Squirrelix.Column{}
structs or maps with :name, :type, and boolean :nullable? keys — the same
shape as metadata-file entries. Results are normalised through
Squirrelix.QueryMetadata.parse/2 before codegen.
The Mix task uses Squirrelix.Postgres.inferrer/1 when --infer is passed.
See the Configuration guide for connection options.
Summary
Callbacks
@callback infer(Squirrelix.Query.t()) :: {:ok, keyword()} | {:error, struct()}