Sha256: 08ea4f399828b4596968284c4909231826687424c08038995ae64762f6662bc4
Contents?: true
Size: 1.71 KB
Versions: 20
Compression:
Stored size: 1.71 KB
Contents
# frozen_string_literal: true module PgEventstore class Event include Extensions::OptionsExtension LINK_TYPE = '$>' # @!attribute id # @return [String] UUIDv4 string attribute(:id) # @!attribute type # @return [String] event type attribute(:type) { self.class.name } # @!attribute global_position # @return [Integer] event's position in "all" stream attribute(:global_position) # @!attribute stream # @return [PgEventstore::Stream, nil] event's stream attribute(:stream) # @!attribute stream_revision # @return [Integer] a revision of an event inside event's stream attribute(:stream_revision) # @!attribute data # @return [Hash] event's data attribute(:data) { {} } # @!attribute metadata # @return [Hash] event's metadata attribute(:metadata) { {} } # @!attribute link_id # @return [String, nil] UUIDv4 of an event the current event points to. If it is not nil, then the current # event is a link attribute(:link_id) # @!attribute created_at # @return [Time, nil] a timestamp an event was created at attribute(:created_at) # Implements comparison of `PgEventstore::Event`-s. Two events matches if all of their attributes matches # @param other [Object, EventStoreClient::DeserializedEvent] # @return [Boolean] def ==(other) return false unless other.is_a?(PgEventstore::Event) attributes_hash == other.attributes_hash end # Detect whether an event is a link event # @return [Boolean] def link? !link_id.nil? end # Detect whether an event is a system event # @return [Boolean] def system? type.start_with?('$') end end end
Version data entries
20 entries across 20 versions & 1 rubygems