db-postgres 0.7.0 → 0.9.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: 2ba17d708434471a3146cf704a5df1f64109ee8d914f73e7fbd07bcee83a04d0
4
- data.tar.gz: 896c9c7c8850266ec0ec93a2f3ccbf35a70edd1bf88d6e9f15b67702338d6f66
3
+ metadata.gz: dda5680ffcdd6de60c833681366779e9859e497ae9b367d3bcf3a84c68f15771
4
+ data.tar.gz: c9d19d688ed762c97539318765b149e477d47e0cf374b774810cd0cd830336ac
5
5
  SHA512:
6
- metadata.gz: 18d4937f8998c303c2816a9a7fc990e0b9af87fc44a25f448a48f20f509fdf6738a697eeca81df043109ebc753585565c0d67c822b350350fa69b3db9248fb82
7
- data.tar.gz: cd4a0d9ea49bbee151193bc512765631c47ea99d97ae495f96d0dd91d709b216fe70840038ec410f538aeaafc3029ba63bd9df0025193dcc2622658b4bcf569d
6
+ metadata.gz: a50d56b3495fa91827ff03e1cf9da2667819f3b23e982ed2619bf5633e53222fc09218e4526c3941ee906b65976c8d1796499405a4f2b85cf3cb3ccce20de58c
7
+ data.tar.gz: 68c172f739f907eca43c9270c9053ce1e0ab4d33da5c8dbcf75852e73bcb4da7d52233abcf44ef628afccfa011d2d8032391e17eec28a4a27eaacf0d59fc7c53
checksums.yaml.gz.sig CHANGED
Binary file
@@ -0,0 +1,37 @@
1
+ # Getting Started
2
+
3
+ This guide explains how to get started with the `db-postgres` gem.
4
+
5
+ ## Installation
6
+
7
+ Add the gem to your project:
8
+
9
+ ~~~ bash
10
+ $ bundle add db-postgres
11
+ ~~~
12
+
13
+ ## Usage
14
+
15
+ Here is an example of the basic usage of the adapter:
16
+
17
+ ~~~ ruby
18
+ require 'async'
19
+ require 'db/postgres'
20
+
21
+ # Create an event loop:
22
+ Sync do
23
+ # Create the adapter and connect to the database:
24
+ adapter = DB::Postgres::Adapter.new(database: 'test')
25
+ connection = adapter.call
26
+
27
+ # Execute the query:
28
+ result = connection.send_query("SELECT VERSION()")
29
+
30
+ # Get the results:
31
+ pp connection.next_result.to_a
32
+ # => [["PostgreSQL 16.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 14.1.1 20240522, 64-bit"]]
33
+ ensure
34
+ # Return the connection to the client connection pool:
35
+ connection.close
36
+ end
37
+ ~~~
@@ -0,0 +1,12 @@
1
+ # Automatically generated context index for Utopia::Project guides.
2
+ # Do not edit then files in this directory directly, instead edit the guides and then run `bake utopia:project:agent:context:update`.
3
+ ---
4
+ description: Ruby FFI bindings for libpq C interface.
5
+ metadata:
6
+ documentation_uri: https://socketry.github.io/db-postgres/
7
+ funding_uri: https://github.com/sponsors/ioquatix
8
+ source_code_uri: https://github.com/socketry/db-postgres.git
9
+ files:
10
+ - path: getting-started.md
11
+ title: Getting Started
12
+ description: This guide explains how to get started with the `db-postgres` gem.
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2018-2024, by Samuel Williams.
22
5
 
23
6
  require_relative 'connection'
24
7
 
@@ -1,28 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2018-2024, by Samuel Williams.
22
5
 
23
6
  require 'async/pool/resource'
24
- require 'async/io/generic'
25
-
7
+ require 'db/features'
26
8
  require_relative 'native/connection'
27
9
 
28
10
  module DB
@@ -123,6 +105,21 @@ module DB
123
105
  def next_result
124
106
  @native.next_result
125
107
  end
108
+
109
+ FEATURES = DB::Features.new(
110
+ alter_column_type: true,
111
+ using_clause: true,
112
+ conditional_operations: true,
113
+ transactional_schema: true,
114
+ batch_alter_table: true,
115
+ concurrent_schema: true,
116
+ serial_columns: true,
117
+ )
118
+
119
+ # Database feature detection for migration and query building.
120
+ def features
121
+ FEATURES
122
+ end
126
123
  end
127
124
  end
128
125
  end
@@ -1,24 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2024, by Samuel Williams.
22
5
 
23
6
  module DB
24
7
  module Postgres
@@ -1,22 +1,7 @@
1
- # Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2018-2024, by Samuel Williams.
20
5
 
21
6
  require_relative 'result'
22
7
  require_relative 'field'
@@ -96,14 +81,8 @@ module DB
96
81
  ffi_attach_function :PQescapeLiteral, [:pointer, :string, :size_t], :pointer, as: :escape_literal
97
82
  ffi_attach_function :PQescapeIdentifier, [:pointer, :string, :size_t], :pointer, as: :escape_identifier
98
83
 
99
- module IO
100
- def self.new(fd, mode)
101
- Async::IO::Generic.new(::IO.new(fd, mode, autoclose: false))
102
- end
103
- end
104
-
105
84
  class Connection < FFI::Pointer
106
- def self.connect(wrapper: IO, types: DEFAULT_TYPES, **options)
85
+ def self.connect(types: DEFAULT_TYPES, **options)
107
86
  # Postgres expects "dbname" as the key name:
108
87
  if database = options.delete(:database)
109
88
  options[:dbname] = database
@@ -120,7 +99,7 @@ module DB
120
99
  pointer = Native.connect_start_params(keys.array, values.array, 0)
121
100
  Native.set_nonblocking(pointer, 1)
122
101
 
123
- io = wrapper.new(Native.socket(pointer), "r+")
102
+ io = ::IO.new(Native.socket(pointer), "r+", autoclose: false)
124
103
 
125
104
  while status = Native.connect_poll(pointer)
126
105
  break if status == :ok || status == :failed
@@ -1,22 +1,7 @@
1
- # Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2024, by Samuel Williams.
20
5
 
21
6
  require_relative 'types'
22
7
 
@@ -41,9 +26,9 @@ module DB
41
26
  float: Types::Float.new,
42
27
  double: Types::Float.new("DOUBLE"),
43
28
 
44
- timestamp: Types::DateTime.new("TIMESTAMP"),
29
+ timestamp: Types::DateTime.new("TIMESTAMPTZ"),
45
30
  date: Types::Date.new,
46
- datetime: Types::DateTime.new("DATETIME"),
31
+ datetime: Types::DateTime.new("TIMESTAMPTZ"),
47
32
  year: Types::Integer.new("LONG"),
48
33
 
49
34
  json: Types::JSON.new,
@@ -1,22 +1,7 @@
1
- # Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2018-2024, by Samuel Williams.
20
5
 
21
6
  require_relative '../native'
22
7
 
@@ -1,22 +1,7 @@
1
- # Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2020-2024, by Samuel Williams.
20
5
 
21
6
  require 'json'
22
7
  require 'bigdecimal'
@@ -99,10 +84,20 @@ module DB
99
84
  attr :name
100
85
 
101
86
  def parse(string)
102
- if string
103
- parts = string.split(/[\-\s:]/)
87
+ if string == '-infinity' || string == 'infinity' || string.nil?
88
+ return string
89
+ end
90
+
91
+ if match = string.match(/\A(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+(?:\.\d+)?)([-+]\d\d(?::\d\d)?)?\z/)
92
+ parts = match.captures
104
93
 
105
- return Time.utc(*parts)
94
+ parts[5] = Rational(parts[5])
95
+
96
+ if parts[6].nil?
97
+ parts[6] = '+00'
98
+ end
99
+
100
+ return Time.new(*parts)
106
101
  end
107
102
  end
108
103
  end
@@ -1,32 +1,17 @@
1
- # Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
20
2
 
21
- require 'ffi/module'
22
- require 'ffi/module/config_tool'
3
+ # Released under the MIT License.
4
+ # Copyright, 2018-2024, by Samuel Williams.
5
+
6
+ require 'ffi/native'
7
+ require 'ffi/native/config_tool'
23
8
 
24
9
  module DB
25
10
  module Postgres
26
11
  module Native
27
- extend FFI::Module::Library
28
- extend FFI::Module::Loader
29
- extend FFI::Module::ConfigTool
12
+ extend FFI::Native::Library
13
+ extend FFI::Native::Loader
14
+ extend FFI::Native::ConfigTool
30
15
 
31
16
  ffi_load('pq') ||
32
17
  ffi_load_using_config_tool(%w{pg_config --libdir}, names: ['pq']) ||
@@ -1,25 +1,10 @@
1
- # Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2018-2024, by Samuel Williams.
20
5
 
21
6
  module DB
22
7
  module Postgres
23
- VERSION = "0.7.0"
8
+ VERSION = "0.9.0"
24
9
  end
25
10
  end
data/lib/db/postgres.rb CHANGED
@@ -1,22 +1,7 @@
1
- # Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2018-2024, by Samuel Williams.
20
5
 
21
6
  require_relative 'postgres/native'
22
7
  require_relative 'postgres/connection'
data/license.md ADDED
@@ -0,0 +1,23 @@
1
+ # MIT License
2
+
3
+ Copyright, 2018-2024, by Samuel Williams.
4
+ Copyright, 2021, by Tony Schneider.
5
+ Copyright, 2022, by Aidan Samuel.
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
data/readme.md ADDED
@@ -0,0 +1,37 @@
1
+ # DB::Postgres
2
+
3
+ A light-weight wrapper for Ruby connecting to Postgres servers. This gem provides an adapter for the [`db` gem](https://github.com/socketry/db). You should use the `db` gem directly as it provides a unified interface for all database adapters and contains the majority of the documentation.
4
+
5
+ [![Development Status](https://github.com/socketry/db-postgres/workflows/Test/badge.svg)](https://github.com/socketry/db-postgres/actions?workflow=Test)
6
+
7
+ ## Usage
8
+
9
+ Please see the [project documentation](https://socketry.github.io/db-postgres/) for more details.
10
+
11
+ - [Getting Started](https://socketry.github.io/db-postgres/guides/getting-started/index) - This guide explains how to get started with the `db-postgres` gem.
12
+
13
+ ## Releases
14
+
15
+ Please see the [project releases](https://socketry.github.io/db-postgres/releases/index) for all releases.
16
+
17
+ ### v0.9.0
18
+
19
+ - Add support for `DB::Features`.
20
+
21
+ ## Contributing
22
+
23
+ We welcome contributions to this project.
24
+
25
+ 1. Fork it.
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`).
28
+ 4. Push to the branch (`git push origin my-new-feature`).
29
+ 5. Create new Pull Request.
30
+
31
+ ### Developer Certificate of Origin
32
+
33
+ In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
34
+
35
+ ### Community Guidelines
36
+
37
+ This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
data/releases.md ADDED
@@ -0,0 +1,5 @@
1
+ # Releases
2
+
3
+ ## v0.9.0
4
+
5
+ - Add support for `DB::Features`.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,57 +1,45 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: db-postgres
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
- autorequire:
8
+ - Aidan Samuel
9
+ - Tony Schneider
9
10
  bindir: bin
10
11
  cert_chain:
11
12
  - |
12
13
  -----BEGIN CERTIFICATE-----
13
- MIIEhDCCAuygAwIBAgIBATANBgkqhkiG9w0BAQsFADA3MTUwMwYDVQQDDCxzYW11
14
- ZWwud2lsbGlhbXMvREM9b3Jpb250cmFuc2Zlci9EQz1jby9EQz1uejAeFw0yMTA4
15
- MTYwNjMzNDRaFw0yMjA4MT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H6AY+HP8
39
+ voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
38
40
  -----END CERTIFICATE-----
39
- date: 2021-10-04 00:00:00.000000000 Z
41
+ date: 1980-01-02 00:00:00.000000000 Z
40
42
  dependencies:
41
- - !ruby/object:Gem::Dependency
42
- name: async-io
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
43
  - !ruby/object:Gem::Dependency
56
44
  name: async-pool
57
45
  requirement: !ruby/object:Gem::Requirement
@@ -67,95 +55,39 @@ dependencies:
67
55
  - !ruby/object:Gem::Version
68
56
  version: '0'
69
57
  - !ruby/object:Gem::Dependency
70
- name: ffi-module
58
+ name: db
71
59
  requirement: !ruby/object:Gem::Requirement
72
60
  requirements:
73
61
  - - "~>"
74
62
  - !ruby/object:Gem::Version
75
- version: 0.3.0
63
+ version: '0.14'
76
64
  type: :runtime
77
65
  prerelease: false
78
66
  version_requirements: !ruby/object:Gem::Requirement
79
67
  requirements:
80
68
  - - "~>"
81
69
  - !ruby/object:Gem::Version
82
- version: 0.3.0
83
- - !ruby/object:Gem::Dependency
84
- name: async-rspec
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: bake
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
70
+ version: '0.14'
111
71
  - !ruby/object:Gem::Dependency
112
- name: bundler
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: covered
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: rspec
72
+ name: ffi-native
141
73
  requirement: !ruby/object:Gem::Requirement
142
74
  requirements:
143
75
  - - "~>"
144
76
  - !ruby/object:Gem::Version
145
- version: '3.6'
146
- type: :development
77
+ version: '0.4'
78
+ type: :runtime
147
79
  prerelease: false
148
80
  version_requirements: !ruby/object:Gem::Requirement
149
81
  requirements:
150
82
  - - "~>"
151
83
  - !ruby/object:Gem::Version
152
- version: '3.6'
153
- description:
154
- email:
84
+ version: '0.4'
155
85
  executables: []
156
86
  extensions: []
157
87
  extra_rdoc_files: []
158
88
  files:
89
+ - context/getting-started.md
90
+ - context/index.yaml
159
91
  - lib/db/postgres.rb
160
92
  - lib/db/postgres/adapter.rb
161
93
  - lib/db/postgres/connection.rb
@@ -166,11 +98,16 @@ files:
166
98
  - lib/db/postgres/native/result.rb
167
99
  - lib/db/postgres/native/types.rb
168
100
  - lib/db/postgres/version.rb
101
+ - license.md
102
+ - readme.md
103
+ - releases.md
169
104
  homepage: https://github.com/socketry/db-postgres
170
105
  licenses:
171
106
  - MIT
172
- metadata: {}
173
- post_install_message:
107
+ metadata:
108
+ documentation_uri: https://socketry.github.io/db-postgres/
109
+ funding_uri: https://github.com/sponsors/ioquatix
110
+ source_code_uri: https://github.com/socketry/db-postgres.git
174
111
  rdoc_options: []
175
112
  require_paths:
176
113
  - lib
@@ -178,15 +115,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
178
115
  requirements:
179
116
  - - ">="
180
117
  - !ruby/object:Gem::Version
181
- version: '2.5'
118
+ version: '3.2'
182
119
  required_rubygems_version: !ruby/object:Gem::Requirement
183
120
  requirements:
184
121
  - - ">="
185
122
  - !ruby/object:Gem::Version
186
123
  version: '0'
187
124
  requirements: []
188
- rubygems_version: 3.2.22
189
- signing_key:
125
+ rubygems_version: 3.6.9
190
126
  specification_version: 4
191
127
  summary: Ruby FFI bindings for libpq C interface.
192
128
  test_files: []
metadata.gz.sig CHANGED
Binary file