Sha256: 6a4a63a2a7dbfeb8b05b0bebead0e784c4af140a640b25fbb2fa06ed6fb982a4
Contents?: true
Size: 1 KB
Versions: 5
Compression:
Stored size: 1 KB
Contents
require 'rom/relation/wrap' module ROM module SQL # Specialized wrap relation for SQL # # This type of relations is returned when using `Relation#wrap` and it uses # a join, unlike `Relation#combine` which makes separate queries. This # means a relation is restricted only to tuples which have associated # tuples, so it should be used in cases where you want to rely on this # restriction. # # @api public class Wrap < Relation::Wrap # Return a schema which includes attributes from wrapped relations # # @return [Schema] # # @api public def schema root.schema.merge(nodes.map(&:schema).reduce(:merge)).qualified end # Internal method used by abstract `ROM::Relation::Wrap` # # @return [Relation] # # @api private def relation relation = nodes.reduce(root) do |a, e| a.associations[e.name.key].join(:join, a, e) end schema.(relation) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
rom-sql-3.1.0 | lib/rom/sql/wrap.rb |
rom-sql-3.0.1 | lib/rom/sql/wrap.rb |
rom-sql-3.0.0 | lib/rom/sql/wrap.rb |
rom-sql-2.5.0 | lib/rom/sql/wrap.rb |
rom-sql-2.4.0 | lib/rom/sql/wrap.rb |