Sha256: d86cb5ecf74a8df6d3e97a6a1872fe26c5c4001e7c718ff7247dc9e7d95a01cc

Contents?: true

Size: 377 Bytes

Versions: 6

Compression:

Stored size: 377 Bytes

Contents

module Getto
  module Repository
    # :nocov:
    class Sequel
      def initialize(db)
        @db = db
      end

      attr_reader :db

      def transaction
        db.transaction do
          yield
        end
      end

      def last_insert_id
        db["select last_insert_id() as id"]
          .map{|hash| hash[:id]}.first
      end
    end
    # :nocov:
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
getto-repository-sequel-1.1.1 lib/getto/repository/sequel.rb
getto-repository-sequel-1.1.0 lib/getto/repository/sequel.rb
getto-repository-sequel-1.0.2 lib/getto/repository/sequel.rb
getto-repository-sequel-1.0.1 lib/getto/repository/sequel.rb
getto-repository-sequel-1.0.0 lib/getto/repository/sequel.rb
getto-repository-sequel-0.1.0 lib/getto/repository/sequel.rb