Class: Rooq::Expression

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/rooq/expression.rb

Overview

Base class for all SQL expressions

Instance Method Summary collapse

Instance Method Details

#%(other) ⇒ ArithmeticExpression

Parameters:

Returns:



110
111
112
# File 'lib/rooq/expression.rb', line 110

def %(other)
  ArithmeticExpression.new(self, :%, other)
end

#*(other) ⇒ ArithmeticExpression

Parameters:

Returns:



100
101
102
# File 'lib/rooq/expression.rb', line 100

def *(other)
  ArithmeticExpression.new(self, :*, other)
end

#+(other) ⇒ ArithmeticExpression

Arithmetic operators

Parameters:

Returns:



90
91
92
# File 'lib/rooq/expression.rb', line 90

def +(other)
  ArithmeticExpression.new(self, :+, other)
end

#-(other) ⇒ ArithmeticExpression

Parameters:

Returns:



95
96
97
# File 'lib/rooq/expression.rb', line 95

def -(other)
  ArithmeticExpression.new(self, :-, other)
end

#/(other) ⇒ ArithmeticExpression

Parameters:

Returns:



105
106
107
# File 'lib/rooq/expression.rb', line 105

def /(other)
  ArithmeticExpression.new(self, :/, other)
end

#as(alias_name) ⇒ AliasedExpression

Parameters:

  • alias_name (Symbol)

Returns:



12
13
14
# File 'lib/rooq/expression.rb', line 12

def as(alias_name)
  AliasedExpression.new(self, alias_name)
end

#ascOrderSpecification

Ordering

Returns:



79
80
81
# File 'lib/rooq/expression.rb', line 79

def asc
  OrderSpecification.new(self, :asc)
end

#between(min, max) ⇒ Condition

Parameters:

  • min (T.untyped)
  • max (T.untyped)

Returns:



63
64
65
# File 'lib/rooq/expression.rb', line 63

def between(min, max)
  Condition.new(self, :between, [min, max])
end

#descOrderSpecification

Returns:



84
85
86
# File 'lib/rooq/expression.rb', line 84

def desc
  OrderSpecification.new(self, :desc)
end

#eq(other) ⇒ Condition

Comparison operators return Conditions

Parameters:

  • other (T.untyped)

Returns:



23
24
25
# File 'lib/rooq/expression.rb', line 23

def eq(other)
  Condition.new(self, :eq, other)
end

#gt(other) ⇒ Condition

Parameters:

  • other (T.untyped)

Returns:



33
34
35
# File 'lib/rooq/expression.rb', line 33

def gt(other)
  Condition.new(self, :gt, other)
end

#gte(other) ⇒ Condition

Parameters:

  • other (T.untyped)

Returns:



43
44
45
# File 'lib/rooq/expression.rb', line 43

def gte(other)
  Condition.new(self, :gte, other)
end

#in(values) ⇒ Condition

Parameters:

Returns:



53
54
55
# File 'lib/rooq/expression.rb', line 53

def in(values)
  Condition.new(self, :in, values)
end

#is_not_nullCondition

Returns:



73
74
75
# File 'lib/rooq/expression.rb', line 73

def is_not_null
  Condition.new(self, :is_not_null, nil)
end

#is_nullCondition

Returns:



68
69
70
# File 'lib/rooq/expression.rb', line 68

def is_null
  Condition.new(self, :is_null, nil)
end

#like(pattern) ⇒ Condition

Parameters:

  • pattern (String)

Returns:



58
59
60
# File 'lib/rooq/expression.rb', line 58

def like(pattern)
  Condition.new(self, :like, pattern)
end

#lt(other) ⇒ Condition

Parameters:

  • other (T.untyped)

Returns:



38
39
40
# File 'lib/rooq/expression.rb', line 38

def lt(other)
  Condition.new(self, :lt, other)
end

#lte(other) ⇒ Condition

Parameters:

  • other (T.untyped)

Returns:



48
49
50
# File 'lib/rooq/expression.rb', line 48

def lte(other)
  Condition.new(self, :lte, other)
end

#ne(other) ⇒ Condition

Parameters:

  • other (T.untyped)

Returns:



28
29
30
# File 'lib/rooq/expression.rb', line 28

def ne(other)
  Condition.new(self, :ne, other)
end

#to_sql(_dialect) ⇒ T.untyped

Parameters:

  • _dialect (T.untyped)

Returns:

  • (T.untyped)

Raises:

  • (NotImplementedError)


17
18
19
# File 'lib/rooq/expression.rb', line 17

def to_sql(_dialect)
  raise NotImplementedError, "Subclasses must implement #to_sql"
end