Class: AlgebraDB::Build::Join
- Inherits:
-
Struct
- Object
- Struct
- AlgebraDB::Build::Join
- Defined in:
- lib/algebra_db/build/join.rb
Overview
Syntax for a join.
Constant Summary collapse
- JOIN_EXPRS =
{ inner: 'INNER JOIN', left: 'LEFT OUTER JOIN', right: 'RIGHT OUTER JOIN', inner_lateral: 'INNER JOIN LATERAL', left_lateral: 'LEFT JOIN LATERAL', right_lateral: 'RIGHT JOIN LATERAL' }.freeze
- TYPES =
JOIN_EXPRS.keys.freeze
Instance Attribute Summary collapse
-
#condition ⇒ Object
Returns the value of attribute condition.
-
#table ⇒ Object
Returns the value of attribute table.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, table, condition) ⇒ Join
constructor
A new instance of Join.
- #join_expr ⇒ Object
- #render_syntax(builder) ⇒ Object
Constructor Details
Instance Attribute Details
#condition ⇒ Object
Returns the value of attribute condition
5 6 7 |
# File 'lib/algebra_db/build/join.rb', line 5 def condition @condition end |
#table ⇒ Object
Returns the value of attribute table
5 6 7 |
# File 'lib/algebra_db/build/join.rb', line 5 def table @table end |
#type ⇒ Object
Returns the value of attribute type
5 6 7 |
# File 'lib/algebra_db/build/join.rb', line 5 def type @type end |
Instance Method Details
#join_expr ⇒ Object
30 31 32 |
# File 'lib/algebra_db/build/join.rb', line 30 def join_expr JOIN_EXPRS[type] end |
#render_syntax(builder) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/algebra_db/build/join.rb', line 23 def render_syntax(builder) builder.text(join_expr) table.render_syntax(builder) builder.text('ON') condition.render_syntax(builder) end |