ant-storage 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb612bf83b1e943966b5e0bcb5c6446f8c07aa4c4d3cbb33ba643ad81ea5779c
4
- data.tar.gz: ab1d3778a052203c30b8ba6f18cef962e2be020fc5c495edf860defa1f884303
3
+ metadata.gz: 74fcda92653cc31a0a6cb389e4020c909e1bba7a7faf87fa6d39da80af4a9729
4
+ data.tar.gz: 70510d3005f06d2bb7c05c818d6e5542c10dd1d0ec12dd1000f3abfc13ce0333
5
5
  SHA512:
6
- metadata.gz: 9ce1084361d00bc45187e63cf19740f269f01fd8ef8be2cca60bce453c8c9157195a8b1351b0b2d792a3e9118931313dace50b2ea1d8ef2df7ac24cece2e2c80
7
- data.tar.gz: d9f58d3fff7c708631b4d7403b89b336ac7c0cb8c5524221e55728112e6f07fdc295d89043361ccaab54443ce542558ce4df85ce49db296460429fbb4a9b7347
6
+ metadata.gz: 9f1b8943c8e10058313a21ed9f336a90aaf0148b187515d7055e4fe38deafdfd8b48c7c6ff0b10e928f785f5ada4ceb10c38e9f0ae29b16056425ed401a6bbff
7
+ data.tar.gz: 8a192fe725fed89b7922a85897f093d90acc97c542d0169e0a510a9dabc0e52697725211b2379421726fae10f2222e94036adab66f71765df605cdb7d38d4367
@@ -8,6 +8,18 @@ module Ant
8
8
  # Repository that fetch and store objects using a sequel connection
9
9
  # as resource.
10
10
  class Sequel < Repository
11
+ def self.from_config(conf)
12
+ conn = ::Sequel.connect(conf['endpoint'], conf)[conf['table'].to_sym]
13
+ if conf['schema'].nil?
14
+ # TODO: decouple use of classes
15
+ new(conn, conf['primary_key'].to_sym,
16
+ IDGenerators[:id])
17
+ else
18
+ # TODO: This line is very high coupled to ant-nanoservice
19
+ new(conn, conf['schema']::PRIMARY_KEY, IDGenerators[:id])
20
+ end
21
+ end
22
+
11
23
  def initialize(sequel_object, id, id_generator)
12
24
  @sequel = sequel_object
13
25
  super(id, id_generator)
@@ -33,7 +45,7 @@ module Ant
33
45
  end
34
46
 
35
47
  def connection
36
- @sequel
48
+ @sequel.db
37
49
  end
38
50
  end
39
51
  end
data/lib/ant/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ant
4
4
  module Storage
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ant-storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gilberto Vargas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-07 00:00:00.000000000 Z
11
+ date: 2019-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ant-core
@@ -202,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
202
  - !ruby/object:Gem::Version
203
203
  version: '0'
204
204
  requirements: []
205
- rubygems_version: 3.0.3
205
+ rubygems_version: 3.0.1
206
206
  signing_key:
207
207
  specification_version: 4
208
208
  summary: Implements storage modules for ant framework