neo4j_bolt 0.1.16 → 0.1.17

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: ceadde284e1bf7c95b86a4929785fa092369144c66ade7c41c0eb956bf8ffa5b
4
- data.tar.gz: 0ca383b2eeff7e0346cf51b1d7d64e86d81fe7019243118b8ab1bb6820ae043a
3
+ metadata.gz: 35e5736941097cb8c26e81e68e7792447cc402e7ee982a69e39ee30c38f732e6
4
+ data.tar.gz: 37fd2134e0ea856282d70469f787272f4fa6fa34df1f89d39487b3088a54b542
5
5
  SHA512:
6
- metadata.gz: 40740b34b21c415f681e4542653caa2ac344ff5ff7546cf8fdefa9d34f45d61cbf90e0c6a9d5d45168c01327924bf53e3514936409bbef624862dea1ca25f47a
7
- data.tar.gz: ce48d7167cf692056442acdcae26c346a0f4d27cf5a7365467f64b72f0e426e07eb2da847d752f8987ddb8c1d17c50937bde913ef8d9755abbc5fa350a1874e4
6
+ metadata.gz: 86b3f5cec2a7e121aacc892d936ce35a4783fadbd463acd44c34fd20da897c45c2451c54c90f95df4c58db9a671234860700dc21819eda913f3b06cfaf3f9645
7
+ data.tar.gz: 87ecb696d47e8bc37837787f006c9226cf674e31b5823b671bae6508c113b99f3e9923724e13a7684998db11900745f997c0185c1b62d86806c16a0c9ec39f1e
data/README.md CHANGED
@@ -96,6 +96,19 @@ node = neo4j_query_expect_one("MATCH (n) RETURN n LIMIT 1;")['n']
96
96
 
97
97
  If there's zero, two, or more results, this will raise a `ExpectedOneResultError`.
98
98
 
99
+ ## Using transactions
100
+
101
+ Any Neo4j query will run in its own transaction by default. If you want to group multiple queries into a transaction to make sure they either succeed completely or fail completely, use `transaction` like this:
102
+
103
+ ```ruby
104
+ transaction do
105
+ neo4j_query("CREATE (n:Node {a: 1});")
106
+ neo4j_query("CREATE (n:Node {b: 1});")
107
+ end
108
+ ```
109
+
110
+ Transactions can be nested, with the inner transactions doing nothing and the outermost transaction being committed unless something goes wrong in which case the outermost transaction gets rolled back. No matter how often you nest transactions, there's only one transaction from the perspective of Neo4j.
111
+
99
112
  ## Setting up constraints and indexes
100
113
 
101
114
  Use `setup_constraints_and_indexes` like this:
@@ -169,7 +182,7 @@ You can see nodes and relationships with their current numbers, plus all propert
169
182
 
170
183
  Uniqueness constraints and indexes (if available) are shown as well if they are defined on a single node or relationship with a single attribute.
171
184
 
172
- If a property is an integer and starts with `ts`, it gets treated as a UNIX timestamp (just for the visualization).
185
+ If a property is an integer and has `ts` or `timestamp` in its name separated from other alphanumeric characters (like `ts_created` but not like `hits`), it gets treated as a UNIX timestamp (just for the visualization).
173
186
 
174
187
  ## Development
175
188
 
data/bin/neo4j_bolt CHANGED
@@ -284,14 +284,15 @@ class App
284
284
  mean_s = sprintf('%1.1f', props[lbl][key][:sum][c].to_f / props[lbl][key][:counts][c]).chomp('.0')
285
285
  min_s = (c == 'float') ? sprintf('%1.1f', props[lbl][key][:min][c]) : props[lbl][key][:min][c]
286
286
  max_s = (c == 'float') ? sprintf('%1.1f', props[lbl][key][:max][c]) : props[lbl][key][:max][c]
287
- if c == 'int' && key[0, 2] == 'ts'
287
+ c_is_ts = (c == 'int') && (key.split(/[^a-zA-Z]+/).any? { |x| x == 'ts' || x == 'timestamp'} )
288
+ if c_is_ts
288
289
  min_s = Time.at(props[lbl][key][:min][c]).strftime('%Y-%m-%d')
289
290
  max_s = Time.at(props[lbl][key][:max][c]).strftime('%Y-%m-%d')
290
291
  end
291
292
  if props[lbl][key][:min][c] == props[lbl][key][:max][c]
292
293
  label += "<td border='1' color='#{rel ? '#888888' : '#000000'}' valign='top' align='center' colspan='6'>#{min_s}</td>"
293
294
  else
294
- if c == 'int' && key[0, 2] == 'ts'
295
+ if c_is_ts
295
296
  label += "<td border='1' color='#{rel ? '#888888' : '#000000'}' valign='top' align='right' colspan='3'>#{min_s}</td>"
296
297
  label += "<td border='1' color='#{rel ? '#888888' : '#000000'}' valign='top' align='right' colspan='3'>#{max_s}</td>"
297
298
  else
@@ -1,3 +1,3 @@
1
1
  module Neo4jBolt
2
- VERSION = "0.1.16"
2
+ VERSION = "0.1.17"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j_bolt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Specht