evt-message_store-postgres 2.4.0.4 → 2.4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 783bbb06bda7af60c00b66718b7021bee6256015988750a57140ff5ae5341543
|
|
4
|
+
data.tar.gz: c4c78ce65e907449deb15fcc0d3cc967d54d8d30f7b6b739a8ccba3bac16f3b1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5962708259cb74332b6541a7db9f718891b602e5f6b65f879293f346c101d2da0c46c70a2e7082b2553fb835c0b46f6f4c475f26ebe765d2fcf7bc1651b2d442
|
|
7
|
+
data.tar.gz: 50d0e5972458e886a69cce45aff22c51cf7f55b712914133b912b1f12e7df94a3791df3b73304dd31a7119b1a81168d601ecbe0f9cc9ca37e2c2e3e09a55b4c6
|
|
@@ -3,10 +3,13 @@ module MessageStore
|
|
|
3
3
|
class Session
|
|
4
4
|
Error = Class.new(RuntimeError)
|
|
5
5
|
|
|
6
|
+
include Dependency
|
|
6
7
|
include Settings::Setting
|
|
7
8
|
|
|
8
9
|
include Log::Dependency
|
|
9
10
|
|
|
11
|
+
dependency :clock, Clock::UTC
|
|
12
|
+
|
|
10
13
|
def self.settings
|
|
11
14
|
Settings.names
|
|
12
15
|
end
|
|
@@ -16,12 +19,17 @@ module MessageStore
|
|
|
16
19
|
end
|
|
17
20
|
|
|
18
21
|
attr_accessor :connection
|
|
22
|
+
attr_accessor :executed_time
|
|
19
23
|
|
|
20
24
|
def self.build(settings: nil)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
instance = new
|
|
26
|
+
|
|
27
|
+
settings ||= Settings.instance
|
|
28
|
+
settings.set(instance)
|
|
29
|
+
|
|
30
|
+
Clock::UTC.configure(instance)
|
|
31
|
+
|
|
32
|
+
instance
|
|
25
33
|
end
|
|
26
34
|
|
|
27
35
|
def self.configure(receiver, session: nil, settings: nil, attr_name: nil)
|
|
@@ -91,15 +99,6 @@ module MessageStore
|
|
|
91
99
|
connection.reset
|
|
92
100
|
end
|
|
93
101
|
|
|
94
|
-
def settings
|
|
95
|
-
settings = {}
|
|
96
|
-
self.class.settings.each do |s|
|
|
97
|
-
val = public_send(s)
|
|
98
|
-
settings[s] = val unless val.nil?
|
|
99
|
-
end
|
|
100
|
-
settings
|
|
101
|
-
end
|
|
102
|
-
|
|
103
102
|
def execute(sql_command, params=nil)
|
|
104
103
|
logger.trace(tag: :session) { "Executing SQL command" }
|
|
105
104
|
logger.trace(tag: :sql) { sql_command }
|
|
@@ -109,17 +108,27 @@ module MessageStore
|
|
|
109
108
|
connect
|
|
110
109
|
end
|
|
111
110
|
|
|
111
|
+
executed_time = nil
|
|
112
|
+
|
|
112
113
|
if params.nil?
|
|
113
114
|
connection.exec(sql_command).tap do
|
|
115
|
+
self.executed_time = clock.now
|
|
114
116
|
logger.debug(tag: :session) { "Executed SQL command (no params)" }
|
|
115
117
|
end
|
|
116
118
|
else
|
|
117
119
|
connection.exec_params(sql_command, params).tap do
|
|
120
|
+
self.executed_time = clock.now
|
|
118
121
|
logger.debug(tag: :session) { "Executed SQL command with params" }
|
|
119
122
|
end
|
|
120
123
|
end
|
|
121
124
|
end
|
|
122
125
|
|
|
126
|
+
def executed_time_elapsed_milliseconds
|
|
127
|
+
return nil if executed_time.nil?
|
|
128
|
+
|
|
129
|
+
(clock.now - executed_time) * 1000
|
|
130
|
+
end
|
|
131
|
+
|
|
123
132
|
def transaction(&blk)
|
|
124
133
|
unless connected?
|
|
125
134
|
connect
|
|
@@ -128,6 +137,23 @@ module MessageStore
|
|
|
128
137
|
connection.transaction(&blk)
|
|
129
138
|
end
|
|
130
139
|
|
|
140
|
+
def escape(data)
|
|
141
|
+
connection = connect
|
|
142
|
+
|
|
143
|
+
escaped_data = connection.escape(data)
|
|
144
|
+
|
|
145
|
+
escaped_data
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def settings
|
|
149
|
+
settings = {}
|
|
150
|
+
self.class.settings.each do |s|
|
|
151
|
+
val = public_send(s)
|
|
152
|
+
settings[s] = val unless val.nil?
|
|
153
|
+
end
|
|
154
|
+
settings
|
|
155
|
+
end
|
|
156
|
+
|
|
131
157
|
def self.logger
|
|
132
158
|
@logger ||= Log.get self
|
|
133
159
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: evt-message_store-postgres
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.4.0
|
|
4
|
+
version: 2.4.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- The Eventide Project
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: scripts
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-02-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: evt-message_store
|
|
@@ -135,6 +135,7 @@ files:
|
|
|
135
135
|
- lib/message_store/postgres/controls/position.rb
|
|
136
136
|
- lib/message_store/postgres/controls/put.rb
|
|
137
137
|
- lib/message_store/postgres/controls/stream_name.rb
|
|
138
|
+
- lib/message_store/postgres/controls/time.rb
|
|
138
139
|
- lib/message_store/postgres/get.rb
|
|
139
140
|
- lib/message_store/postgres/get/category.rb
|
|
140
141
|
- lib/message_store/postgres/get/category/consumer_group.rb
|
|
@@ -152,7 +153,7 @@ homepage: https://github.com/eventide-project/message-store-postgres
|
|
|
152
153
|
licenses:
|
|
153
154
|
- MIT
|
|
154
155
|
metadata: {}
|
|
155
|
-
post_install_message:
|
|
156
|
+
post_install_message:
|
|
156
157
|
rdoc_options: []
|
|
157
158
|
require_paths:
|
|
158
159
|
- lib
|
|
@@ -167,8 +168,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
167
168
|
- !ruby/object:Gem::Version
|
|
168
169
|
version: '0'
|
|
169
170
|
requirements: []
|
|
170
|
-
rubygems_version: 3.
|
|
171
|
-
signing_key:
|
|
171
|
+
rubygems_version: 3.3.3
|
|
172
|
+
signing_key:
|
|
172
173
|
specification_version: 4
|
|
173
174
|
summary: Message store implementation for PostgreSQL
|
|
174
175
|
test_files: []
|