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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/context/getting-started.md +37 -0
- data/context/index.yaml +12 -0
- data/lib/db/postgres/adapter.rb +2 -19
- data/lib/db/postgres/connection.rb +18 -21
- data/lib/db/postgres/error.rb +2 -19
- data/lib/db/postgres/native/connection.rb +6 -27
- data/lib/db/postgres/native/field.rb +6 -21
- data/lib/db/postgres/native/result.rb +4 -19
- data/lib/db/postgres/native/types.rb +17 -22
- data/lib/db/postgres/native.rb +9 -24
- data/lib/db/postgres/version.rb +5 -20
- data/lib/db/postgres.rb +4 -19
- data/license.md +23 -0
- data/readme.md +37 -0
- data/releases.md +5 -0
- data.tar.gz.sig +0 -0
- metadata +48 -112
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dda5680ffcdd6de60c833681366779e9859e497ae9b367d3bcf3a84c68f15771
|
4
|
+
data.tar.gz: c9d19d688ed762c97539318765b149e477d47e0cf374b774810cd0cd830336ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
+
~~~
|
data/context/index.yaml
ADDED
@@ -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.
|
data/lib/db/postgres/adapter.rb
CHANGED
@@ -1,24 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
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
|
-
#
|
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 '
|
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
|
data/lib/db/postgres/error.rb
CHANGED
@@ -1,24 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
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
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
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(
|
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 =
|
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
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
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("
|
29
|
+
timestamp: Types::DateTime.new("TIMESTAMPTZ"),
|
45
30
|
date: Types::Date.new,
|
46
|
-
datetime: Types::DateTime.new("
|
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
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
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
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
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
|
-
|
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
|
-
|
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
|
data/lib/db/postgres/native.rb
CHANGED
@@ -1,32 +1,17 @@
|
|
1
|
-
#
|
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
|
-
|
22
|
-
|
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::
|
28
|
-
extend FFI::
|
29
|
-
extend FFI::
|
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']) ||
|
data/lib/db/postgres/version.rb
CHANGED
@@ -1,25 +1,10 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
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.
|
8
|
+
VERSION = "0.9.0"
|
24
9
|
end
|
25
10
|
end
|
data/lib/db/postgres.rb
CHANGED
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
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
|
+
[](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
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.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
|
-
|
8
|
+
- Aidan Samuel
|
9
|
+
- Tony Schneider
|
9
10
|
bindir: bin
|
10
11
|
cert_chain:
|
11
12
|
- |
|
12
13
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
14
|
+
MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
|
15
|
+
ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
|
16
|
+
CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
|
17
|
+
MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
|
18
|
+
MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
|
19
|
+
bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
|
20
|
+
igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
|
21
|
+
9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
|
22
|
+
sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE
|
23
|
+
e5AUKRwUuvaUaumAKgPH+4E4oiLXI4T1Ff5Q7xxv6yXvHuYtlMHhYfgNn8iiW8WN
|
24
|
+
XibYXPNP7NtieSQqwR/xM6IRSoyXKuS+ZNGDPUUGk8RoiV/xvVN4LrVm9upSc0ss
|
25
|
+
RZ6qwOQmXCo/lLcDUxJAgG95cPw//sI00tZan75VgsGzSWAOdjQpFM0l4dxvKwHn
|
26
|
+
tUeT3ZsAgt0JnGqNm2Bkz81kG4A2hSyFZTFA8vZGhp+hz+8Q573tAR89y9YJBdYM
|
27
|
+
zp0FM4zwMNEUwgfRzv1tEVVUEXmoFCyhzonUUw4nE4CFu/sE3ffhjKcXcY//qiSW
|
28
|
+
xm4erY3XAgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
29
|
+
BBYEFO9t7XWuFf2SKLmuijgqR4sGDlRsMC4GA1UdEQQnMCWBI3NhbXVlbC53aWxs
|
30
|
+
aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWBI3NhbXVlbC53aWxs
|
31
|
+
aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEBCwUAA4IBgQB5sxkE
|
32
|
+
cBsSYwK6fYpM+hA5B5yZY2+L0Z+27jF1pWGgbhPH8/FjjBLVn+VFok3CDpRqwXCl
|
33
|
+
xCO40JEkKdznNy2avOMra6PFiQyOE74kCtv7P+Fdc+FhgqI5lMon6tt9rNeXmnW/
|
34
|
+
c1NaMRdxy999hmRGzUSFjozcCwxpy/LwabxtdXwXgSay4mQ32EDjqR1TixS1+smp
|
35
|
+
8C/NCWgpIfzpHGJsjvmH2wAfKtTTqB9CVKLCWEnCHyCaRVuKkrKjqhYCdmMBqCws
|
36
|
+
JkxfQWC+jBVeG9ZtPhQgZpfhvh+6hMhraUYRQ6XGyvBqEUe+yo6DKIT3MtGE2+CP
|
37
|
+
eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
|
38
|
+
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
39
|
+
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
38
40
|
-----END CERTIFICATE-----
|
39
|
-
date:
|
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:
|
58
|
+
name: db
|
71
59
|
requirement: !ruby/object:Gem::Requirement
|
72
60
|
requirements:
|
73
61
|
- - "~>"
|
74
62
|
- !ruby/object:Gem::Version
|
75
|
-
version: 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.
|
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:
|
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: '
|
146
|
-
type: :
|
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: '
|
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
|
-
|
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
|
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.
|
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
|