neo4j 9.1.7 → 9.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/neo4j/shared/declared_property.rb +12 -21
- data/lib/neo4j/shared/type_converters.rb +7 -7
- data/lib/neo4j/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 842191c44b13a4617ba19ce62e6b5d3179678c1e
|
4
|
+
data.tar.gz: 43f5f578a72409ee07c739331212c72b0a4996be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0f44c117c92a7ab2851d58ac0a515a3f72e63826fae0939088681832cce66022da8f3b6ea93319d413d3f80015e0ae2224435ab7f817ee1265e2ecf7557f586
|
7
|
+
data.tar.gz: 75ce59a03daf27109d80013780109b05c8573552631cc7ae26cb9f748e3ffe0d8ba1c2ae1d3d67d0450e04b216d0f04d78c4508a3439c53c4575af9467240e98
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
This file should follow the standards specified on [http://keepachangelog.com/]
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## [9.1.8] 2018-03-27
|
7
|
+
|
8
|
+
## Fixed
|
9
|
+
|
10
|
+
- Micro-optimizations which help when dealing with a lot of data (thanks @jgaskins / see #1490)
|
11
|
+
|
6
12
|
## [9.1.7] 2018-03-27
|
7
13
|
|
8
14
|
## Fixed
|
@@ -7,13 +7,17 @@ module Neo4j::Shared
|
|
7
7
|
include Neo4j::Shared::DeclaredProperty::Index
|
8
8
|
|
9
9
|
ILLEGAL_PROPS = %w(from_node to_node start_node end_node)
|
10
|
-
attr_reader :name, :name_string, :name_sym, :options, :magic_typecaster
|
10
|
+
attr_reader :name, :name_string, :name_sym, :options, :magic_typecaster, :type, :typecaster, :default_value
|
11
|
+
alias default default_value
|
11
12
|
|
12
13
|
def initialize(name, options = {})
|
13
14
|
fail IllegalPropertyError, "#{name} is an illegal property" if ILLEGAL_PROPS.include?(name.to_s)
|
14
15
|
fail TypeError, "can't convert #{name.class} into Symbol" unless name.respond_to?(:to_sym)
|
15
16
|
@name = @name_sym = name.to_sym
|
16
17
|
@name_string = name.to_s
|
18
|
+
@type = options[:type]
|
19
|
+
@typecaster = options[:typecaster]
|
20
|
+
@default_value = options[:default]
|
17
21
|
@options = options
|
18
22
|
fail_invalid_options!
|
19
23
|
end
|
@@ -55,19 +59,6 @@ module Neo4j::Shared
|
|
55
59
|
register_magic_properties
|
56
60
|
end
|
57
61
|
|
58
|
-
def type
|
59
|
-
options[:type]
|
60
|
-
end
|
61
|
-
|
62
|
-
def typecaster
|
63
|
-
options[:typecaster]
|
64
|
-
end
|
65
|
-
|
66
|
-
def default_value
|
67
|
-
options[:default]
|
68
|
-
end
|
69
|
-
alias default default_value
|
70
|
-
|
71
62
|
def fail_invalid_options!
|
72
63
|
case
|
73
64
|
when index?(:exact) && constraint?(:unique)
|
@@ -89,7 +80,7 @@ module Neo4j::Shared
|
|
89
80
|
|
90
81
|
# Tweaks properties
|
91
82
|
def register_magic_properties
|
92
|
-
|
83
|
+
@type ||= Neo4j::Config.timestamp_type if timestamp_prop?
|
93
84
|
|
94
85
|
register_magic_typecaster
|
95
86
|
register_type_converter
|
@@ -100,18 +91,18 @@ module Neo4j::Shared
|
|
100
91
|
end
|
101
92
|
|
102
93
|
def register_magic_typecaster
|
103
|
-
found_typecaster = Neo4j::Shared::TypeConverters.typecaster_for(
|
94
|
+
found_typecaster = Neo4j::Shared::TypeConverters.typecaster_for(type)
|
104
95
|
return unless found_typecaster && found_typecaster.respond_to?(:primitive_type)
|
105
|
-
|
106
|
-
@magic_typecaster =
|
107
|
-
|
96
|
+
@typecaster = found_typecaster
|
97
|
+
@magic_typecaster = type
|
98
|
+
@type = found_typecaster.primitive_type
|
108
99
|
end
|
109
100
|
|
110
101
|
def register_type_converter
|
111
102
|
converter = options[:serializer]
|
112
103
|
return unless converter
|
113
|
-
|
114
|
-
|
104
|
+
@type = converter.convert_type
|
105
|
+
@typecaster = Neo4j::Shared::TypeConverters::ObjectConverter
|
115
106
|
Neo4j::Shared::TypeConverters.register_converter(converter)
|
116
107
|
end
|
117
108
|
end
|
@@ -101,7 +101,7 @@ module Neo4j::Shared
|
|
101
101
|
end
|
102
102
|
|
103
103
|
class BooleanConverter < BaseConverter
|
104
|
-
FALSE_VALUES = %w(n N no No NO false False FALSE off Off OFF f F)
|
104
|
+
FALSE_VALUES = %w(n N no No NO false False FALSE off Off OFF f F).to_set
|
105
105
|
|
106
106
|
class << self
|
107
107
|
def converted?(value)
|
@@ -362,24 +362,24 @@ module Neo4j::Shared
|
|
362
362
|
|
363
363
|
def converted_property(type, value, direction)
|
364
364
|
return nil if value.nil?
|
365
|
-
type.respond_to?(:db_type)
|
365
|
+
CONVERTERS[type] || type.respond_to?(:db_type) ? TypeConverters.to_other(direction, value, type) : value
|
366
366
|
end
|
367
367
|
|
368
368
|
# If the attribute is to be typecast using a custom converter, which converter should it use? If no, returns the type to find a native serializer.
|
369
369
|
def primitive_type(attr)
|
370
370
|
case
|
371
|
-
when
|
371
|
+
when serialized_properties.include?(attr)
|
372
372
|
serialized_properties[attr]
|
373
|
-
when
|
374
|
-
|
373
|
+
when magic_typecast_properties.include?(attr)
|
374
|
+
magic_typecast_properties[attr]
|
375
375
|
else
|
376
|
-
|
376
|
+
fetch_upstream_primitive(attr)
|
377
377
|
end
|
378
378
|
end
|
379
379
|
|
380
380
|
# Returns true if the property isn't defined in the model or if it is nil
|
381
381
|
def skip_conversion?(obj, attr, value)
|
382
|
-
!obj.class.attributes
|
382
|
+
value.nil? || !obj.class.attributes.key?(attr)
|
383
383
|
end
|
384
384
|
|
385
385
|
class << self
|
data/lib/neo4j/version.rb
CHANGED