Class: Symbol
- Includes:
- Sequel::Postgres::ArrayOpMethods, Sequel::Postgres::HStoreOpMethods, Sequel::Postgres::InetOpMethods, Sequel::Postgres::JSONOpMethods, Sequel::Postgres::PGRowOp::ExpressionMethods, Sequel::Postgres::RangeOpMethods, Sequel::SQL::AliasMethods, Sequel::SQL::BooleanMethods, Sequel::SQL::CastMethods, Sequel::SQL::ComplexExpressionMethods, Sequel::SQL::InequalityMethods, Sequel::SQL::NumericMethods, Sequel::SQL::OrderMethods, Sequel::SQL::QualifyingMethods, Sequel::SQL::StringMethods, Sequel::SQL::SubscriptMethods
- Defined in:
- lib/sequel/extensions/core_extensions.rb,
lib/sequel/extensions/pg_row_ops.rb,
lib/sequel/extensions/pg_inet_ops.rb,
lib/sequel/extensions/pg_json_ops.rb,
lib/sequel/extensions/pg_array_ops.rb,
lib/sequel/extensions/pg_range_ops.rb,
lib/sequel/extensions/pg_hstore_ops.rb,
lib/sequel/extensions/ruby18_symbol_extensions.rb
Overview
Sequel extends Symbol
to add methods to implement the SQL DSL.
Instance Method Summary collapse
-
#[](*args) ⇒ Object
Create an SQL Function with the receiver as the function name and the given arguments.
-
#identifier ⇒ Object
Returns receiver wrapped in an
Sequel::SQL::Identifier
. -
#sql_function(*args) ⇒ Object
Returns a
Sequel::SQL::Function
with this as the function name, and the given arguments.
Methods included from Sequel::SQL::ComplexExpressionMethods
#extract, #sql_boolean, #sql_number, #sql_string
Methods included from Sequel::SQL::SubscriptMethods
Methods included from Sequel::SQL::StringMethods
Methods included from Sequel::SQL::QualifyingMethods
Methods included from Sequel::SQL::NumericMethods
Methods included from Sequel::SQL::BooleanMethods
Methods included from Sequel::SQL::OrderMethods
Methods included from Sequel::SQL::CastMethods
#cast, #cast_numeric, #cast_string
Methods included from Sequel::SQL::AliasMethods
Methods included from Sequel::Postgres::HStoreOpMethods
Methods included from Sequel::Postgres::RangeOpMethods
Methods included from Sequel::Postgres::ArrayOpMethods
Methods included from Sequel::Postgres::JSONOpMethods
Methods included from Sequel::Postgres::InetOpMethods
Methods included from Sequel::Postgres::PGRowOp::ExpressionMethods
Instance Method Details
#[](*args) ⇒ Object
Create an SQL Function with the receiver as the function name and the given arguments.
21 22 23 |
# File 'lib/sequel/extensions/ruby18_symbol_extensions.rb', line 21 def [](*args) Sequel::SQL::Function.new(self, *args) end |
#identifier ⇒ Object
Returns receiver wrapped in an Sequel::SQL::Identifier
. Usually used to prevent splitting the symbol.
:a__b # SQL: "a"."b"
:a__b.identifier # SQL: "a__b"
213 214 215 |
# File 'lib/sequel/extensions/core_extensions.rb', line 213 def identifier Sequel::SQL::Identifier.new(self) end |
#sql_function(*args) ⇒ Object
Returns a Sequel::SQL::Function
with this as the function name, and the given arguments. This is aliased as Symbol#[]
if the RUBY_VERSION is less than 1.9.0. Ruby 1.9 defines Symbol#[]
, and Sequel doesn’t override methods defined by ruby itself.
:now.sql_function # SQL: now()
:sum.sql_function(:a) # SQL: sum(a)
:concat.sql_function(:a, :b) # SQL: concat(a, b)
225 226 227 |
# File 'lib/sequel/extensions/core_extensions.rb', line 225 def sql_function(*args) Sequel::SQL::Function.new(self, *args) end |