Skip to content

Documentation


Documentation / @blazetrails/activerecord / QueryTransformer

Interface: QueryTransformer ​

Defined in: packages/activerecord/lib/query-transformers.ts:16

Global registry of query transformers applied to every SQL statement before it is executed.

Mirrors: ActiveRecord.query_transformers (active_record.rb) — singleton_class.attr_accessor :query_transformers / self.query_transformers = []. Rails iterates this list in preprocess_query: ActiveRecord.query_transformers.each { |t| sql = t.call(sql, self) }.

A transformer is any object responding to call(sql, connection) and returning the (possibly rewritten) SQL — ActiveRecord::QueryLogs is the canonical one. The connection slot is opaque to the registry, hence unknown rather than any.

Methods ​

call() ​

call(sql, connection): string

Defined in: packages/activerecord/lib/query-transformers.ts:17

Parameters ​

ParameterType
sqlstring
connectionunknown

Returns ​

string