evt-entity_snapshot-postgres 0.2.1.1 → 0.2.2.0

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
  SHA1:
3
- metadata.gz: aa1cd3c0e9a4086aac69afa87bb64a6be0d532c9
4
- data.tar.gz: 4351fdc6a3eac09019eaa66bdfc060f0f93e60b3
3
+ metadata.gz: '0659a420fe52e00fa922e64c188ead319c389c1f'
4
+ data.tar.gz: 95ec4185f382c4c4a209db18d1f813bebf03a3ed
5
5
  SHA512:
6
- metadata.gz: 65218bdc27d1d85df05c23ac2d898dbd9e1a9fc422ca5c04c9658ce0619ada92578ed84f6909922503fecb6dc8f1d4662abe061c145e7209e9e2e31bc384ef19
7
- data.tar.gz: 60467a1d447a8ab08453c7f97c5a7ee2a63f64f67680a75da83bb221e156cba2ea2d0e859b43247a0ed3f007dcff35c7131419b65dc3ed84470cbfc71d87d0b0
6
+ metadata.gz: ae9b9a86f53b0dbbefb617af3be0d95648d14fd6ff35a3459f88612130c2c5dfe729d71bfcc40247721090c5fdf89ea36e6071fbe8823e869f3b7b4a4175213e
7
+ data.tar.gz: 29820de092b82ce8240b6a483e1d74b697ad6b5cc42ea2b3d5f843ac415a3feb7b6ca9a8b914c409c9f9f6e265ff994e7e526cc36d49088c249151199333349d
@@ -7,6 +7,7 @@ require 'entity_snapshot/postgres/controls/version'
7
7
  require 'entity_snapshot/postgres/controls/message'
8
8
  require 'entity_snapshot/postgres/controls/batch'
9
9
  require 'entity_snapshot/postgres/controls/entity'
10
+ require 'entity_snapshot/postgres/controls/random_value'
10
11
  require 'entity_snapshot/postgres/controls/snapshot'
11
12
  require 'entity_snapshot/postgres/controls/write'
12
13
  require 'entity_snapshot/postgres/controls/entity_store'
@@ -3,29 +3,44 @@ module EntitySnapshot
3
3
  module Controls
4
4
  module Entity
5
5
  def self.example
6
- Example.build(Data.example)
6
+ attributes = {
7
+ :some_attribute => RandomValue.example,
8
+ :some_time => Time::Raw.example
9
+ }
10
+
11
+ Example.build(attributes)
7
12
  end
8
13
 
9
14
  class Example
10
15
  include Schema::DataStructure
11
16
 
12
- attribute :some_attribute
17
+ attribute :some_attribute, String
18
+ attribute :some_time, ::Time
13
19
 
14
20
  module Transformer
15
21
  def self.raw_data(instance)
16
- instance.to_h
22
+ {
23
+ :some_attribute => instance.some_attribute,
24
+ :some_time => Clock.iso8601(instance.some_time)
25
+ }
17
26
  end
18
27
 
19
28
  def self.instance(raw_data)
20
- Example.build(raw_data)
29
+ Example.build({
30
+ :some_attribute => raw_data[:some_attribute],
31
+ :some_time => Clock.parse(raw_data[:some_time])
32
+ })
21
33
  end
22
34
  end
23
35
  end
24
36
 
25
37
  module Data
26
- def self.example
38
+ def self.example(some_attribute=nil)
39
+ some_attribute ||= RandomValue.example
40
+
27
41
  {
28
- some_attribute: MessageStore::Controls::RandomValue.example
42
+ some_attribute: some_attribute,
43
+ some_time: Time::ISO8601.example
29
44
  }
30
45
  end
31
46
  end
@@ -0,0 +1,7 @@
1
+ module EntitySnapshot
2
+ class Postgres
3
+ module Controls
4
+ RandomValue = MessageStore::Controls::RandomValue
5
+ end
6
+ end
7
+ end
@@ -63,7 +63,10 @@ module EntitySnapshot
63
63
  return
64
64
  end
65
65
 
66
- entity = entity_class.build(event_data.data[:entity_data])
66
+ entity_data = event_data.data[:entity_data]
67
+
68
+ entity = Transform::Read.instance(entity_data, entity_class)
69
+
67
70
  version = event_data.data[:entity_version]
68
71
  time = event_data.time
69
72
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-entity_snapshot-postgres
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1.1
4
+ version: 0.2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-17 00:00:00.000000000 Z
11
+ date: 2017-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-entity_store
@@ -65,6 +65,7 @@ files:
65
65
  - lib/entity_snapshot/postgres/controls/entity_store.rb
66
66
  - lib/entity_snapshot/postgres/controls/id.rb
67
67
  - lib/entity_snapshot/postgres/controls/message.rb
68
+ - lib/entity_snapshot/postgres/controls/random_value.rb
68
69
  - lib/entity_snapshot/postgres/controls/snapshot.rb
69
70
  - lib/entity_snapshot/postgres/controls/stream_name.rb
70
71
  - lib/entity_snapshot/postgres/controls/time.rb