Sha256: 12a2e3215e7eb82872a346c679e19102ff1c99893ff76ff1fd5fc5183bf7c819

Contents?: true

Size: 567 Bytes

Versions: 142

Compression:

Stored size: 567 Bytes

Contents

# frozen-string-literal: true
#
# The sql_expr extension adds the sql_expr method to every object, which
# returns an wrapped object that works nicely with Sequel's DSL by calling
# Sequel.expr:
#
#   1.sql_expr < :a     # 1 < a
#   false.sql_expr & :a # FALSE AND a
#   true.sql_expr | :a  # TRUE OR a
#   ~nil.sql_expr       # NOT NULL
#   "a".sql_expr + "b"  # 'a' || 'b'
#
# To load the extension:
#
#   Sequel.extension :sql_expr

#
class Object
  # Return the object wrapper in an appropriate Sequel expression object.
  def sql_expr
    Sequel[self]
  end
end

Version data entries

142 entries across 123 versions & 2 rubygems

Version Path
sequel-5.43.0 lib/sequel/extensions/sql_expr.rb
sequel-5.42.0 lib/sequel/extensions/sql_expr.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/sequel-5.39.0/lib/sequel/extensions/sql_expr.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/sequel-5.41.0/lib/sequel/extensions/sql_expr.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/sequel-5.38.0/lib/sequel/extensions/sql_expr.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/sequel-5.41.0/lib/sequel/extensions/sql_expr.rb
sequel-5.41.0 lib/sequel/extensions/sql_expr.rb
sequel-5.40.0 lib/sequel/extensions/sql_expr.rb
sequel-5.39.0 lib/sequel/extensions/sql_expr.rb
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/sequel-5.38.0/lib/sequel/extensions/sql_expr.rb
sequel-5.38.0 lib/sequel/extensions/sql_expr.rb
sequel-5.37.0 lib/sequel/extensions/sql_expr.rb
sequel-5.36.0 lib/sequel/extensions/sql_expr.rb
tdiary-5.1.3 vendor/bundle/ruby/2.6.0/gems/sequel-5.32.0/lib/sequel/extensions/sql_expr.rb
tdiary-5.1.3 vendor/bundle/ruby/2.7.0/gems/sequel-5.35.0/lib/sequel/extensions/sql_expr.rb
sequel-5.35.0 lib/sequel/extensions/sql_expr.rb
sequel-5.34.0 lib/sequel/extensions/sql_expr.rb
sequel-5.33.0 lib/sequel/extensions/sql_expr.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/sequel-5.26.0/lib/sequel/extensions/sql_expr.rb
tdiary-5.1.2 vendor/bundle/ruby/2.7.0/gems/sequel-5.32.0/lib/sequel/extensions/sql_expr.rb