Sha256: ff9f1447e60d01f8f676be16df8b5714f719bb42e797bd7186a67135851a9802

Contents?: true

Size: 389 Bytes

Versions: 6

Compression:

Stored size: 389 Bytes

Contents

require 'sequel'

module SandthornDriverSequel
  class SequelDriver

    def initialize(args = {})
      Sequel.default_timezone = :utc
      @db = args.fetch(:connection) {
        Sequel.connect(args.fetch(:url))
      }
    end

    def execute
      yield @db
    end

    def execute_in_transaction &block
      @db.transaction do
        block.call(@db)
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sandthorn_driver_sequel-4.1.0 lib/sandthorn_driver_sequel/sequel_driver.rb
sandthorn_driver_sequel-4.0.0 lib/sandthorn_driver_sequel/sequel_driver.rb
sandthorn_driver_sequel-3.2.1 lib/sandthorn_driver_sequel/sequel_driver.rb
sandthorn_driver_sequel-3.2.0 lib/sandthorn_driver_sequel/sequel_driver.rb
sandthorn_driver_sequel-3.1.0 lib/sandthorn_driver_sequel/sequel_driver.rb
sandthorn_driver_sequel-3.0.0 lib/sandthorn_driver_sequel/sequel_driver.rb