db-active_record 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +3 -0
- data/lib/active_record/connection_adapters/db_mariadb_adapter.rb +19 -0
- data/lib/active_record/connection_adapters/db_postgres_adapter.rb +20 -0
- data/lib/db/active_record/adapter/mariadb.rb +26 -0
- data/lib/db/active_record/adapter/postgres.rb +38 -0
- data/lib/db/active_record/version.rb +10 -0
- data/lib/db/active_record.rb +6 -0
- data/license.md +21 -0
- data/readme.md +27 -0
- data.tar.gz.sig +0 -0
- metadata +136 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f398624df4de37941ab9b922043ec21e3c58471ee75e9c0741acad38ba933984
|
4
|
+
data.tar.gz: f58fc66563d419dec34c83bd521e253dcb93a083ed5908bdc0957876e4a886a6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c0928133b41f2b8b2641b37ae7a2d6470b64406ba971ea8c772802989b28994193161aedcaca4a10d671c739fb01c522edead020dfd317c37b5c5363aa5635a8
|
7
|
+
data.tar.gz: fbfcb58382f21eec264b6a4996894aad890b5af8e0f0369fb581e15e183097eddcb4fd0fc142ecef7828042a1307bb3081213bdcc598e7adc6e90f749ac64580
|
checksums.yaml.gz.sig
ADDED
@@ -0,0 +1,3 @@
|
|
1
|
+
��]�L�';�29)O�M�}�l�/�����%p�j[�_η�1+t����˜�H��E��ㅔ4���t
|
2
|
+
��;��쟗&�G�#�z?J�jx�r�h�2C���t4W+�/�5p����(�S{E�^�T%{1Ơ��&� #cHc�7~�����z�^�`�%fu�]�}�� �!��D���B����N�G�OHs9Xe��p>!��]���^�ɿYeXC�f>�&�9;Wwj�Z9��q������G7nl�lOh�PxT�B�~�<^R�Jgw��V1���&Ș�NbsOl�����Pw]l�x�Ҳ��vP���kd'�,�v�
|
3
|
+
p
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2022-2024, by Samuel Williams.
|
5
|
+
|
6
|
+
require_relative "../../db/active_record/adapter/mariadb"
|
7
|
+
|
8
|
+
module ActiveRecord
|
9
|
+
module ConnectionHandling
|
10
|
+
def db_mariadb_connection(config)
|
11
|
+
config = config.symbolize_keys.compact
|
12
|
+
config.delete(:adapter)
|
13
|
+
|
14
|
+
adapter = DB::MariaDB::Adapter.new(**config)
|
15
|
+
|
16
|
+
return DB::ActiveRecord::Adapter::MariaDB.new(adapter, config)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2022-2024, by Samuel Williams.
|
5
|
+
|
6
|
+
require_relative "../../db/active_record/adapter/postgres"
|
7
|
+
require "db/client"
|
8
|
+
|
9
|
+
module ActiveRecord
|
10
|
+
module ConnectionHandling
|
11
|
+
def db_postgres_connection(config)
|
12
|
+
config = config.symbolize_keys.compact
|
13
|
+
config.delete(:adapter)
|
14
|
+
|
15
|
+
adapter = DB::Postgres::Adapter.new(**config)
|
16
|
+
|
17
|
+
return DB::ActiveRecord::Adapter::Postgres.new(adapter, config)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2022, by Samuel Williams.
|
5
|
+
|
6
|
+
require "active_support"
|
7
|
+
require "active_record"
|
8
|
+
require "active_record/connection_adapters/abstract_adapter"
|
9
|
+
|
10
|
+
require "db/mariadb"
|
11
|
+
|
12
|
+
module DB
|
13
|
+
module ActiveRecord
|
14
|
+
module Adapter
|
15
|
+
class MariaDB < ::ActiveRecord::ConnectionAdapters::AbstractAdapter
|
16
|
+
def self.new_client(config)
|
17
|
+
DB::MariaDB::Connection.new(**config)
|
18
|
+
end
|
19
|
+
|
20
|
+
def connect
|
21
|
+
@raw_connection = self.class.new_client(@config)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2022-2024, by Samuel Williams.
|
5
|
+
|
6
|
+
require "active_support"
|
7
|
+
require "active_record"
|
8
|
+
require "active_record/connection_adapters/abstract_adapter"
|
9
|
+
|
10
|
+
require "db/postgres"
|
11
|
+
|
12
|
+
module DB
|
13
|
+
module ActiveRecord
|
14
|
+
module Adapter
|
15
|
+
class Postgres < ::ActiveRecord::ConnectionAdapters::AbstractAdapter
|
16
|
+
def initialize(adapter, config)
|
17
|
+
super(config)
|
18
|
+
|
19
|
+
@adapter = adapter
|
20
|
+
end
|
21
|
+
|
22
|
+
def connect
|
23
|
+
@raw_connection ||= @adapter.call
|
24
|
+
end
|
25
|
+
|
26
|
+
def raw_execute(sql, name, **options)
|
27
|
+
log(sql, name) do
|
28
|
+
connection = self.connect
|
29
|
+
|
30
|
+
connection.send_query(sql)
|
31
|
+
|
32
|
+
connection.next_result.to_a
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/license.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# MIT License
|
2
|
+
|
3
|
+
Copyright, 2022-2024, by Samuel Williams.
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/readme.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# DB::ActiveRecord
|
2
|
+
|
3
|
+
Provides ActiveRecord connection adaptors for the DB gem.
|
4
|
+
|
5
|
+
[![Development Status](https://github.com/socketry/db-active_record/workflows/Test/badge.svg)](https://github.com/socketry/db-active_record/actions?workflow=Test)
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
This gem is an experiment, and while very basic aspects of it work, it is not yet ready for any kind of real world usage.
|
10
|
+
|
11
|
+
## Contributing
|
12
|
+
|
13
|
+
We welcome contributions to this project.
|
14
|
+
|
15
|
+
1. Fork it.
|
16
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
17
|
+
3. Commit your changes (`git commit -am 'Add some feature'`).
|
18
|
+
4. Push to the branch (`git push origin my-new-feature`).
|
19
|
+
5. Create new Pull Request.
|
20
|
+
|
21
|
+
### Developer Certificate of Origin
|
22
|
+
|
23
|
+
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.
|
24
|
+
|
25
|
+
### Community Guidelines
|
26
|
+
|
27
|
+
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.tar.gz.sig
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: db-active_record
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Samuel Williams
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
|
14
|
+
ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
|
15
|
+
CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
|
16
|
+
MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
|
17
|
+
MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
|
18
|
+
bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
|
19
|
+
igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
|
20
|
+
9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
|
21
|
+
sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE
|
22
|
+
e5AUKRwUuvaUaumAKgPH+4E4oiLXI4T1Ff5Q7xxv6yXvHuYtlMHhYfgNn8iiW8WN
|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U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
38
|
+
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
39
|
+
-----END CERTIFICATE-----
|
40
|
+
date: 2024-07-28 00:00:00.000000000 Z
|
41
|
+
dependencies:
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: activerecord
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '7.1'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '7.1'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: async-io
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: async-pool
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: db
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :runtime
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
description:
|
99
|
+
email:
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- lib/active_record/connection_adapters/db_mariadb_adapter.rb
|
105
|
+
- lib/active_record/connection_adapters/db_postgres_adapter.rb
|
106
|
+
- lib/db/active_record.rb
|
107
|
+
- lib/db/active_record/adapter/mariadb.rb
|
108
|
+
- lib/db/active_record/adapter/postgres.rb
|
109
|
+
- lib/db/active_record/version.rb
|
110
|
+
- license.md
|
111
|
+
- readme.md
|
112
|
+
homepage: https://github.com/socketry/db-active_record
|
113
|
+
licenses:
|
114
|
+
- MIT
|
115
|
+
metadata:
|
116
|
+
source_code_uri: https://github.com/socketry/db-active_record.git
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '3.1'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
requirements: []
|
132
|
+
rubygems_version: 3.5.11
|
133
|
+
signing_key:
|
134
|
+
specification_version: 4
|
135
|
+
summary: Asynchronous database adapters for ActiveRecord.
|
136
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|