ductr-postgres 0.2.2 → 0.2.3

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: 36ad408e367b91cf43f7c39992afc4b0436a9ce485026c3d36886005dc7f3083
4
- data.tar.gz: aa9cba25e04afb1b9546bc9f94e2ae227f1965068365d0568da49f6a69e06082
3
+ metadata.gz: 6520956f9b414c8d7d5160d2372a918d3049eb6e2e77253ca452508873d2be53
4
+ data.tar.gz: ea1a31f688bac96edb6086979cb8971801d4627aee0f388ca446e7eba8146382
5
5
  SHA512:
6
- metadata.gz: 51ee731c10a8dfd6e2db2b6c6c0d1887b8fcdacdbe82ba1b5e81a4ac5cfd154f2ffcf9bbe7a7d1c77270bc430fe8001ac8ac2d09bbc423fbd5442667998ee929
7
- data.tar.gz: 364f2b5da9a2fc1699ee5078deebcdcb7f2c4eaf78e0b119a51a0083ac23e8494815dfadc41ca7891435f5ce07bff6fcf2f656edf54396cdd03b5911355a94bb
6
+ metadata.gz: a266df884d476d6959462c84163db5b4845b2b2f6bb410f0b787a9c87c22fb4312c3d281a646adc3c6a806710d3b95869da037992a1a33224742ece1a7a7ea57
7
+ data.tar.gz: b378256691dec18c7bf1cf037f616e75335bbb1bbe0eb99d9e08cd180974b5fd85f508472078142eb0a3967e56d39e20923bd8b2bd45428657cdc8c07acc562c
@@ -31,12 +31,7 @@ module Ductr
31
31
  # @return [Sequel::Database] The database connection instance
32
32
  #
33
33
  def open!
34
- @db = Sequel.postgres(**config)
35
-
36
- @db.extension(:pg_streaming)
37
- @db.stream_all_queries = true
38
-
39
- @db
34
+ @db = new_connection
40
35
  end
41
36
 
42
37
  #
@@ -47,6 +42,20 @@ module Ductr
47
42
  def close!
48
43
  @db.disconnect
49
44
  end
45
+
46
+ #
47
+ # Open a new connection, ensure to close it with the #disconnect method.
48
+ #
49
+ # @return [Sequel::Database] The database connection instance
50
+ #
51
+ def new_connection
52
+ db = Sequel.postgres(**config)
53
+
54
+ db.extension(:pg_streaming)
55
+ db.stream_all_queries = true
56
+
57
+ db
58
+ end
50
59
  end
51
60
  end
52
61
  end
@@ -7,7 +7,7 @@ module Ductr
7
7
  #
8
8
  # destination :some_postgres_database, :basic
9
9
  # def select_some_stuff(db, row)
10
- # db[:items].update(row)
10
+ # db[:items].where(id: row[:id]).update(**row)
11
11
  # end
12
12
  #
13
13
  class BasicDestination < Ductr::SequelBase::BasicDestination
@@ -3,6 +3,6 @@
3
3
  module Ductr
4
4
  module Postgres
5
5
  # @return [String] VERSION Gem's version
6
- VERSION = "0.2.2"
6
+ VERSION = "0.2.3"
7
7
  end
8
8
  end
@@ -49,6 +49,12 @@ module Ductr
49
49
 
50
50
  # Closes the database connection.
51
51
  def close!: () -> void
52
+
53
+ # sord warn - Sequel::Database wasn't able to be resolved to a constant in this project
54
+ # Open a new connection, ensure to close it with the #disconnect method.
55
+ #
56
+ # _@return_ — The database connection instance
57
+ def new_connection: () -> Sequel::Database
52
58
  end
53
59
 
54
60
  #
@@ -135,7 +141,7 @@ module Ductr
135
141
  #
136
142
  # destination :some_postgres_database, :basic
137
143
  # def select_some_stuff(db, row)
138
- # db[:items].update(row)
144
+ # db[:items].where(id: row[:id]).update(**row)
139
145
  # end
140
146
  class BasicDestination < Ductr::SequelBase::BasicDestination
141
147
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ductr-postgres
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathieu Morel