Class: Rooq::Expression
- Inherits:
-
Object
- Object
- Rooq::Expression
- Extended by:
- T::Sig
- Defined in:
- lib/rooq/expression.rb
Overview
Base class for all SQL expressions
Direct Known Subclasses
AliasedExpression, ArithmeticExpression, CaseExpression, CastExpression, Field, FunctionCall, Literal, WindowFunction
Instance Method Summary collapse
- #%(other) ⇒ ArithmeticExpression
- #*(other) ⇒ ArithmeticExpression
-
#+(other) ⇒ ArithmeticExpression
Arithmetic operators.
- #-(other) ⇒ ArithmeticExpression
- #/(other) ⇒ ArithmeticExpression
- #as(alias_name) ⇒ AliasedExpression
-
#asc ⇒ OrderSpecification
Ordering.
- #between(min, max) ⇒ Condition
- #desc ⇒ OrderSpecification
-
#eq(other) ⇒ Condition
Comparison operators return Conditions.
- #gt(other) ⇒ Condition
- #gte(other) ⇒ Condition
- #in(values) ⇒ Condition
- #is_not_null ⇒ Condition
- #is_null ⇒ Condition
- #like(pattern) ⇒ Condition
- #lt(other) ⇒ Condition
- #lte(other) ⇒ Condition
- #ne(other) ⇒ Condition
- #to_sql(_dialect) ⇒ T.untyped
Instance Method Details
#%(other) ⇒ ArithmeticExpression
110 111 112 |
# File 'lib/rooq/expression.rb', line 110 def %(other) ArithmeticExpression.new(self, :%, other) end |
#*(other) ⇒ ArithmeticExpression
100 101 102 |
# File 'lib/rooq/expression.rb', line 100 def *(other) ArithmeticExpression.new(self, :*, other) end |
#+(other) ⇒ ArithmeticExpression
Arithmetic operators
90 91 92 |
# File 'lib/rooq/expression.rb', line 90 def +(other) ArithmeticExpression.new(self, :+, other) end |
#-(other) ⇒ ArithmeticExpression
95 96 97 |
# File 'lib/rooq/expression.rb', line 95 def -(other) ArithmeticExpression.new(self, :-, other) end |
#/(other) ⇒ ArithmeticExpression
105 106 107 |
# File 'lib/rooq/expression.rb', line 105 def /(other) ArithmeticExpression.new(self, :/, other) end |
#as(alias_name) ⇒ AliasedExpression
12 13 14 |
# File 'lib/rooq/expression.rb', line 12 def as(alias_name) AliasedExpression.new(self, alias_name) end |
#asc ⇒ OrderSpecification
Ordering
79 80 81 |
# File 'lib/rooq/expression.rb', line 79 def asc OrderSpecification.new(self, :asc) end |
#between(min, max) ⇒ Condition
63 64 65 |
# File 'lib/rooq/expression.rb', line 63 def between(min, max) Condition.new(self, :between, [min, max]) end |
#desc ⇒ OrderSpecification
84 85 86 |
# File 'lib/rooq/expression.rb', line 84 def desc OrderSpecification.new(self, :desc) end |
#eq(other) ⇒ Condition
Comparison operators return Conditions
23 24 25 |
# File 'lib/rooq/expression.rb', line 23 def eq(other) Condition.new(self, :eq, other) end |
#gt(other) ⇒ Condition
33 34 35 |
# File 'lib/rooq/expression.rb', line 33 def gt(other) Condition.new(self, :gt, other) end |
#gte(other) ⇒ Condition
43 44 45 |
# File 'lib/rooq/expression.rb', line 43 def gte(other) Condition.new(self, :gte, other) end |
#in(values) ⇒ Condition
53 54 55 |
# File 'lib/rooq/expression.rb', line 53 def in(values) Condition.new(self, :in, values) end |
#is_not_null ⇒ Condition
73 74 75 |
# File 'lib/rooq/expression.rb', line 73 def is_not_null Condition.new(self, :is_not_null, nil) end |
#is_null ⇒ Condition
68 69 70 |
# File 'lib/rooq/expression.rb', line 68 def is_null Condition.new(self, :is_null, nil) end |
#like(pattern) ⇒ Condition
58 59 60 |
# File 'lib/rooq/expression.rb', line 58 def like(pattern) Condition.new(self, :like, pattern) end |
#lt(other) ⇒ Condition
38 39 40 |
# File 'lib/rooq/expression.rb', line 38 def lt(other) Condition.new(self, :lt, other) end |
#lte(other) ⇒ Condition
48 49 50 |
# File 'lib/rooq/expression.rb', line 48 def lte(other) Condition.new(self, :lte, other) end |
#ne(other) ⇒ Condition
28 29 30 |
# File 'lib/rooq/expression.rb', line 28 def ne(other) Condition.new(self, :ne, other) end |
#to_sql(_dialect) ⇒ T.untyped
17 18 19 |
# File 'lib/rooq/expression.rb', line 17 def to_sql(_dialect) raise NotImplementedError, "Subclasses must implement #to_sql" end |