TRANSFORM |
= |
proc do |values, ref|
type = ref.send(:cached_fetch, :_pg_eager_any_typed_array_type) do
key = ref.predicate_key
next if key.is_a?(Array)
while key.is_a?(SQL::QualifiedIdentifier)
key = key.column
end
# :nocov:
# many_to_pg_array association type does not need changes, as it
# already converts the values to a typed postgres array, it does
# not call the code that uses :eager_loading_predicate_transform.
#
# No association type that ships with Sequel can reach this code
# unless it is one of these types, but external association types
# could potentially reach it.
sch = case ref[:type]
# :nocov:
when :many_to_one, :one_to_one, :one_to_many, :pg_array_to_many
ref.associated_class.db_schema
when :many_to_many, :one_through_one
# Not compatible with the :join_table_db option, but that option
# does not call into this code.
Hash[ref.associated_class.db.schema(ref.join_table_source)]
when :many_through_many, :one_through_many
# Not compatible with the :separate_query_per_table option, but
# that option does not call into this code.
Hash[ref.associated_class.db.schema(ref[:through][0][:table])]
end
if sch && (sch = sch[key])
sch[:db_type]
end
end |
|
|