grumlin 0.20.2 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +4 -0
- data/gremlin_server/Dockerfile +1 -1
- data/grumlin.gemspec +1 -1
- data/lib/grumlin/repository.rb +7 -0
- data/lib/grumlin/shortcuts/properties.rb +5 -4
- data/lib/grumlin/shortcuts/upserts.rb +2 -2
- data/lib/grumlin/version.rb +1 -1
- metadata +3 -4
- data/CHANGELOG.md +0 -71
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb67bbe2eff3a7fd02cce19c6052fa70e3f54f3ec2cb06102667f69e43d07e8d
|
4
|
+
data.tar.gz: 1ecf0285f60fab6fd93bd0b36bfe58c39b94eebf0ead055f6f3cc4f2e9f8b19d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '05263993fc271810fd493ae3d5fdd8d84b6b698a8d9a4e4a4c336b09858571b156971b6f3def4bdb2d9c3743b07bebeb40eb1c426e4c316a8aa4a87b264f15b5'
|
7
|
+
data.tar.gz: 78fc706c4694146ff2b5fedc75b1d0186dca152fc9f2731c1b6936ea906e6410077c95871fba8b4c302f375cc8b28afffa37ccb59097a88470e266c4f26e6c51
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
grumlin (0.
|
4
|
+
grumlin (0.21.0)
|
5
5
|
async-pool (~> 0.3)
|
6
6
|
async-websocket (~> 0.19)
|
7
7
|
oj (~> 3.13)
|
@@ -72,7 +72,7 @@ GEM
|
|
72
72
|
racc (~> 1.4)
|
73
73
|
nokogiri (1.13.6-x86_64-linux)
|
74
74
|
racc (~> 1.4)
|
75
|
-
oj (3.13.
|
75
|
+
oj (3.13.18)
|
76
76
|
overcommit (0.59.1)
|
77
77
|
childprocess (>= 0.6.3, < 5)
|
78
78
|
iniparse (~> 1.4)
|
data/README.md
CHANGED
@@ -231,6 +231,10 @@ All of them support 3 different modes for error handling: `:retry`, `:ignore` an
|
|
231
231
|
with [retryable](https://github.com/nfedyashev/retryable). **params will be merged to the default config for upserts
|
232
232
|
and passed to `Retryable.retryable`. In case if you want to modify retryable behaviour you are to do so.
|
233
233
|
|
234
|
+
If you don't want to define you own repository, simply use
|
235
|
+
|
236
|
+
`Grumlin::Repository.new` returns an instance of an anonymous class extending `Grumlin::Repository`.
|
237
|
+
|
234
238
|
**Usage**
|
235
239
|
|
236
240
|
To execute the query defined in a query block one simply needs to call a method with the same name:
|
data/gremlin_server/Dockerfile
CHANGED
data/grumlin.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.metadata["homepage_uri"] = spec.homepage
|
22
22
|
spec.metadata["source_code_uri"] = "https://github.com/zhulik/grumlin"
|
23
|
-
spec.metadata["changelog_uri"] = "https://github.com/
|
23
|
+
spec.metadata["changelog_uri"] = "https://github.com/babbel/grumlin/releases"
|
24
24
|
spec.metadata["rubygems_mfa_required"] = "true"
|
25
25
|
|
26
26
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
data/lib/grumlin/repository.rb
CHANGED
@@ -10,6 +10,7 @@ module Grumlin
|
|
10
10
|
}.freeze
|
11
11
|
|
12
12
|
def self.extended(base)
|
13
|
+
super
|
13
14
|
base.extend(Grumlin::Shortcuts)
|
14
15
|
base.include(Repository::InstanceMethods)
|
15
16
|
|
@@ -17,6 +18,12 @@ module Grumlin
|
|
17
18
|
base.shortcuts_from(Grumlin::Shortcuts::Upserts)
|
18
19
|
end
|
19
20
|
|
21
|
+
def self.new
|
22
|
+
@repository ||= Class.new do # rubocop:disable Naming/MemoizedInstanceVariableName
|
23
|
+
extend Grumlin::Repository
|
24
|
+
end.new
|
25
|
+
end
|
26
|
+
|
20
27
|
def query(name, return_mode: :list, postprocess_with: nil, &query_block) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
21
28
|
return_mode = validate_return_mode!(return_mode)
|
22
29
|
postprocess_with = validate_postprocess_with!(postprocess_with)
|
@@ -5,11 +5,12 @@ module Grumlin
|
|
5
5
|
module Properties
|
6
6
|
extend Grumlin::Shortcuts
|
7
7
|
|
8
|
-
shortcut :props do
|
9
|
-
props.reduce(self) do |tt, (prop, value)|
|
10
|
-
next tt
|
8
|
+
shortcut :props do |cardinality = nil, **props|
|
9
|
+
props.reduce(self) do |tt, (prop, value)|
|
10
|
+
next tt if value.nil? # nils are not supported
|
11
|
+
next tt.property(prop, value) if cardinality.nil?
|
11
12
|
|
12
|
-
tt
|
13
|
+
tt.property(cardinality, prop, value)
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
@@ -10,8 +10,8 @@ module Grumlin
|
|
10
10
|
.fold
|
11
11
|
.coalesce(
|
12
12
|
__.unfold,
|
13
|
-
__.addV(label).props(**create_properties.merge(T.id => id))
|
14
|
-
).props(**update_properties)
|
13
|
+
__.addV(label).props(Cardinality.single, **create_properties.merge(T.id => id))
|
14
|
+
).props(Cardinality.single, **update_properties)
|
15
15
|
end
|
16
16
|
|
17
17
|
shortcut :upsertE do |label, from, to, create_properties = {}, update_properties = {}|
|
data/lib/grumlin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grumlin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gleb Sinyavskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-pool
|
@@ -96,7 +96,6 @@ files:
|
|
96
96
|
- ".rspec"
|
97
97
|
- ".rubocop.yml"
|
98
98
|
- ".tool-versions"
|
99
|
-
- CHANGELOG.md
|
100
99
|
- CODE_OF_CONDUCT.md
|
101
100
|
- Gemfile
|
102
101
|
- Gemfile.lock
|
@@ -168,7 +167,7 @@ licenses:
|
|
168
167
|
metadata:
|
169
168
|
homepage_uri: https://github.com/zhulik/grumlin
|
170
169
|
source_code_uri: https://github.com/zhulik/grumlin
|
171
|
-
changelog_uri: https://github.com/
|
170
|
+
changelog_uri: https://github.com/babbel/grumlin/releases
|
172
171
|
rubygems_mfa_required: 'true'
|
173
172
|
post_install_message:
|
174
173
|
rdoc_options: []
|
data/CHANGELOG.md
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
## [0.16.0] - 2022-03-11
|
2
|
-
|
3
|
-
- Query building is rewritten from scratch. No public APIs were changed. [Details](https://github.com/babbel/grumlin/pull/64)
|
4
|
-
- Add support for [TextP](https://tinkerpop.apache.org/javadocs/current/core/org/apache/tinkerpop/gremlin/process/traversal/TextP.html)
|
5
|
-
|
6
|
-
## [0.15.4] - 2022-01-20
|
7
|
-
|
8
|
-
- Move step and expression definitions to a yaml file for better diffs
|
9
|
-
- Add `definitions:format` rake task
|
10
|
-
|
11
|
-
## [0.15.3] - 2022-01-18
|
12
|
-
|
13
|
-
- Fix passing nils as step arguments. Even if they are not supported by the server, they should not be omitted.
|
14
|
-
|
15
|
-
## [0.15.2] - 2022-01-17
|
16
|
-
|
17
|
-
- New steps: `map` and `identity`
|
18
|
-
|
19
|
-
## [0.15.1] - 2022-01-17
|
20
|
-
|
21
|
-
- Fix passing arrays as step arguments
|
22
|
-
|
23
|
-
## [0.15.0] - 2022-01-11
|
24
|
-
|
25
|
-
- Add `properties` step
|
26
|
-
- Add proper support for bulked results
|
27
|
-
- Add support for `Property` objects
|
28
|
-
|
29
|
-
## [0.14.5] - 2021-12-27
|
30
|
-
|
31
|
-
- Fix params handling
|
32
|
-
- Add `aggregate` step
|
33
|
-
- Add `Order.shuffle`
|
34
|
-
|
35
|
-
## [0.14.4] - 2021-12-17
|
36
|
-
|
37
|
-
- `Grumlin::Repository.shorcuts_from` do not raise `ArgumentError` when importing an already existing shortcut
|
38
|
-
pointing to the same block. This fixes importing shortcuts from another repository.
|
39
|
-
|
40
|
-
## [0.14.2] - 2021-12-13
|
41
|
-
|
42
|
-
- Fix `Module` bloating
|
43
|
-
- Add `Operator` expressions
|
44
|
-
- Add `__.coalesce` and `__.constant`
|
45
|
-
- Add steps: `sum`, `sack`
|
46
|
-
- Add configuration steps: `withSack`
|
47
|
-
- Rename `Grumlin::Expressions::Tool` to `Grumlin::Expressions::Expression`
|
48
|
-
|
49
|
-
|
50
|
-
## [0.14.2] - 2021-12-12
|
51
|
-
|
52
|
-
- Better exceptions
|
53
|
-
- Add `choose` step
|
54
|
-
- Add `__.hasNot`, `__.is`, `__.select`
|
55
|
-
|
56
|
-
## [0.14.0] - 2021-12-07
|
57
|
-
|
58
|
-
- Add initial support for [configuration steps](https://tinkerpop.apache.org/docs/current/reference/#configuration-steps)
|
59
|
-
- Add the `withSideEffect` configuration step
|
60
|
-
- Fix passing keyword arguments to regular steps
|
61
|
-
- *Drop support for ruby 2.6*
|
62
|
-
|
63
|
-
## [0.13.0] - 2021-12-03
|
64
|
-
|
65
|
-
- Add `Shortcuts` and `Repository`
|
66
|
-
- Allow executing any gremlin steps by name using `Grumlin::AnonymousStep#step`
|
67
|
-
- Rename `Grumlin::Tools` to `Grumlin::Expressions`
|
68
|
-
|
69
|
-
## [0.1.0] - 2021-05-25
|
70
|
-
|
71
|
-
- Initial release
|