Sha256: a3a91bd66d1c4b4fc0cb53b277cf079543facddac98c248902b8c3c98032af2a

Contents?: true

Size: 537 Bytes

Versions: 4

Compression:

Stored size: 537 Bytes

Contents

# frozen_string_literal: true

module Eventsimple
  module Outbox
    class Cursor < Eventsimple.configuration.parent_record_klass
      self.table_name = 'eventsimple_outbox_cursors'

      def self.fetch(identifier)
        existing = find_by(identifier: identifier)
        existing ? existing.cursor : 0
      end

      def self.set(identifier, cursor)
        upsert(
          {
            identifier: identifier,
            cursor: cursor,
          },
          unique_by: [:identifier],
        )
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eventsimple-1.5.6 lib/eventsimple/outbox/models/cursor.rb
eventsimple-1.5.5 lib/eventsimple/outbox/models/cursor.rb
eventsimple-1.5.4 lib/eventsimple/outbox/models/cursor.rb
eventsimple-1.5.3 lib/eventsimple/outbox/models/cursor.rb