Module: ArelExtensions::NullFunctions
- Defined in:
- lib/arel_extensions/null_functions.rb
Instance Method Summary collapse
-
#coalesce(*args) ⇒ Object
returns the first non-null expr in the expression list.
-
#is_not_null ⇒ Object
ISNOTNULL function lets you return an alternative value when an expression is NOT NULL.
-
#is_null ⇒ Object
ISNULL function lets you return an alternative value when an expression is NULL.
Instance Method Details
#coalesce(*args) ⇒ Object
returns the first non-null expr in the expression list. You must specify at least two expressions. If all occurrences of expr evaluate to null, then the function returns null.
18 19 20 21 |
# File 'lib/arel_extensions/null_functions.rb', line 18 def coalesce *args args.unshift(self) ArelExtensions::Nodes::Coalesce.new args end |
#is_not_null ⇒ Object
ISNOTNULL function lets you return an alternative value when an expression is NOT NULL.
12 13 14 |
# File 'lib/arel_extensions/null_functions.rb', line 12 def is_not_null ArelExtensions::Nodes::IsNotNull.new [self] end |
#is_null ⇒ Object
ISNULL function lets you return an alternative value when an expression is NULL.
7 8 9 |
# File 'lib/arel_extensions/null_functions.rb', line 7 def is_null ArelExtensions::Nodes::IsNull.new [self] end |