Class: CommandPost::SequenceGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/command_post/identity/sequence_generator.rb

Class Method Summary collapse

Class Method Details

.aggregate_idObject



13
14
15
16
17
18
19
20
# File 'lib/command_post/identity/sequence_generator.rb', line 13

def self.aggregate_id
  @@DB ||= Connection.db_cqrs
  val = 0
  @@DB.fetch("SELECT nextval('aggregate');") do |row|
    val = row[row.keys.first]
  end
  val
end

.miscObject



31
32
33
34
35
36
37
38
# File 'lib/command_post/identity/sequence_generator.rb', line 31

def self.misc
  @@DB ||= Connection.db_cqrs
  val = 0
  @@DB.fetch("SELECT nextval('misc');") do |row|
    val = row[row.keys.first]
  end
  val
end

.transaction_idObject



22
23
24
25
26
27
28
29
# File 'lib/command_post/identity/sequence_generator.rb', line 22

def self.transaction_id
  @@DB ||= Connection.db_cqrs
  val = 0
  @@DB.fetch("SELECT nextval('transaction');") do |row|
    val = row[row.keys.first]
  end
  val
end