Sha256: cf0ebe3e21f7f003bb36d43a3bc26806af52761600b22ee0756516abce7cc69b

Contents?: true

Size: 837 Bytes

Versions: 3

Compression:

Stored size: 837 Bytes

Contents

require 'sequel'

module SandthornDriverSequel
  class SequelDriver
    def initialize args = {}
      @url = args.fetch(:url)
      Sequel.default_timezone = :utc
      @db = Sequel.connect(@url)
    end
    def execute &block
      return block.call @db
    end
    def execute_in_transaction &block
      @db.transaction {|tr|
        return block.call @db
      }
    end

  end
end


# module SandthornDriverSequel
#   class SequelDriver
#     def initialize args = {}
#       @url = args.fetch(:url)
#       Sequel.default_timezone = :utc
#     end
#     def execute &block
#       Sequel.connect(@url) { |db| return block.call db}
#     end
#     def execute_in_transaction &block
#       Sequel.connect(@url) do |db|
#         db.transaction do
#           return block.call db
#         end
#       end
#     end 
#   end
# end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sandthorn_driver_sequel-1.1.0 lib/sandthorn_driver_sequel/sequel_driver.rb
sandthorn_driver_sequel-1.0.6 lib/sandthorn_driver_sequel/sequel_driver.rb
sandthorn_driver_sequel-1.0.5 lib/sandthorn_driver_sequel/sequel_driver.rb