Module: Veritas::SQL::Generator::Function::Numeric

Includes:
Veritas::SQL::Generator::Function
Included in:
Relation::Unary
Defined in:
lib/veritas/sql/generator/function/numeric.rb

Overview

Generates an SQL statement for a numeric function

Constant Summary collapse

ABSOLUTE =
'ABS'.freeze
ADD =
'+'.freeze
SUBTRACT =
'-'.freeze
MULTIPLY =
'*'.freeze
DIVIDE =
'/'.freeze
POWER =
'POWER'.freeze
MOD =
'MOD'.freeze
SQUARE_ROOT =
'SQRT'.freeze

Constants included from Identifier

Identifier::ESCAPED_QUOTE, Identifier::QUOTE

Constants included from Literal

Literal::ESCAPED_QUOTE, Literal::FALSE, Literal::NULL, Literal::QUOTE, Literal::SEPARATOR, Literal::TIME_SCALE, Literal::TRUE

Instance Method Summary collapse

Methods included from Attribute

#visit_veritas_attribute

Methods included from Identifier

#visit_identifier

Methods included from Literal

dup_frozen, #visit_class, #visit_date, #visit_date_time, #visit_enumerable, #visit_false_class, #visit_nil_class, #visit_numeric, #visit_string, #visit_time, #visit_true_class

Instance Method Details

#visit_veritas_function_numeric_absolute(absolute) ⇒ #to_s

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Visit an Absolute function

Parameters:

  • absolute (Function::Numeric::Absolute)

Returns:

  • (#to_s)


28
29
30
# File 'lib/veritas/sql/generator/function/numeric.rb', line 28

def visit_veritas_function_numeric_absolute(absolute)
  unary_prefix_operation_sql(ABSOLUTE, absolute)
end

#visit_veritas_function_numeric_addition(addition) ⇒ #to_s

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Visit an Addition function

Parameters:

  • addition (Function::Numeric::Addition)

Returns:

  • (#to_s)


39
40
41
# File 'lib/veritas/sql/generator/function/numeric.rb', line 39

def visit_veritas_function_numeric_addition(addition)
  Generator.parenthesize!(binary_infix_operation_sql(ADD, addition))
end

#visit_veritas_function_numeric_division(division) ⇒ #to_s

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Visit a Division function

Parameters:

  • division (Function::Numeric::Division)

Returns:

  • (#to_s)


50
51
52
# File 'lib/veritas/sql/generator/function/numeric.rb', line 50

def visit_veritas_function_numeric_division(division)
  Generator.parenthesize!(binary_infix_operation_sql(DIVIDE, division))
end

#visit_veritas_function_numeric_exponentiation(exponentiation) ⇒ #to_s

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Visit a Exponentiation function

Parameters:

  • exponentiation (Function::Numeric::Exponentiation)

Returns:

  • (#to_s)


61
62
63
# File 'lib/veritas/sql/generator/function/numeric.rb', line 61

def visit_veritas_function_numeric_exponentiation(exponentiation)
  binary_prefix_operation_sql(POWER, exponentiation)
end

#visit_veritas_function_numeric_modulo(modulo) ⇒ #to_s

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Visit a Modulo function

Parameters:

  • modulo (Function::Numeric::Modulo)

Returns:

  • (#to_s)


72
73
74
# File 'lib/veritas/sql/generator/function/numeric.rb', line 72

def visit_veritas_function_numeric_modulo(modulo)
  binary_prefix_operation_sql(MOD, modulo)
end

#visit_veritas_function_numeric_multiplication(multiplication) ⇒ #to_s

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Visit a Multiplication function

Parameters:

  • multiplication (Function::Numeric::Multiplication)

Returns:

  • (#to_s)


83
84
85
# File 'lib/veritas/sql/generator/function/numeric.rb', line 83

def visit_veritas_function_numeric_multiplication(multiplication)
  Generator.parenthesize!(binary_infix_operation_sql(MULTIPLY, multiplication))
end

#visit_veritas_function_numeric_square_root(square_root) ⇒ #to_s

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Visit a Square Root function

Parameters:

  • square_root (Function::Numeric::SquareRoot)

Returns:

  • (#to_s)


94
95
96
# File 'lib/veritas/sql/generator/function/numeric.rb', line 94

def visit_veritas_function_numeric_square_root(square_root)
  unary_prefix_operation_sql(SQUARE_ROOT, square_root)
end

#visit_veritas_function_numeric_subtraction(subtraction) ⇒ #to_s

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Visit an Addition function

Parameters:

  • subtraction (Function::Numeric::Addition)

Returns:

  • (#to_s)


105
106
107
# File 'lib/veritas/sql/generator/function/numeric.rb', line 105

def visit_veritas_function_numeric_subtraction(subtraction)
  Generator.parenthesize!(binary_infix_operation_sql(SUBTRACT, subtraction))
end

#visit_veritas_function_numeric_unary_minus(unary_minus) ⇒ #to_s

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Visit an Unary Minus function

Parameters:

  • unary_minus (Function::Numeric::UnaryMinus)

Returns:

  • (#to_s)


116
117
118
# File 'lib/veritas/sql/generator/function/numeric.rb', line 116

def visit_veritas_function_numeric_unary_minus(unary_minus)
  unary_prefix_operation_sql(SUBTRACT, unary_minus)
end

#visit_veritas_function_numeric_unary_plus(unary_plus) ⇒ #to_s

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Visit an Unary Plus function

Parameters:

  • unary_plus (Function::Numeric::UnaryPlus)

Returns:

  • (#to_s)


127
128
129
# File 'lib/veritas/sql/generator/function/numeric.rb', line 127

def visit_veritas_function_numeric_unary_plus(unary_plus)
  unary_prefix_operation_sql(ADD, unary_plus)
end