couchbase 3.4.1-arm64-darwin-20 → 3.4.2-arm64-darwin-20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/couchbase/cluster.rb +13 -9
- data/lib/couchbase/cluster_registry.rb +7 -2
- data/lib/couchbase/configuration.rb +3 -4
- data/lib/couchbase/libcouchbase.bundle +0 -0
- data/lib/couchbase/options.rb +85 -2
- data/lib/couchbase/search_options.rb +158 -240
- data/lib/couchbase/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faa96b8ef64469a07b7665a4d70a8f25cc43003361ee727c403db2514890b96b
|
4
|
+
data.tar.gz: 43936d9b52ce4a258d24a83111d85b4d19704d54a3ab26d5169a32c1af5d79d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ca2f3e4cd54458cc4b4ee6399d79ba31e716640f1727aaee9f37d8916a3de13f5cdcb8e4a4849fa4c9d50b6bbe982ed8c728351b957fa4f5484ae96d96ba891
|
7
|
+
data.tar.gz: 712cf52caa8edfeb978c879575f204d44c69f42f9867d1b2232337d6ce103a4407669136ad27619e721c35f0b2802b6530966662b0d0806bc45aad59810ed1b1
|
data/README.md
CHANGED
@@ -23,7 +23,7 @@ The library has been tested with MRI 3.0, 3.1 and 3.2. Supported platforms are L
|
|
23
23
|
Add this line to your application's Gemfile:
|
24
24
|
|
25
25
|
```ruby
|
26
|
-
gem "couchbase", "3.4.
|
26
|
+
gem "couchbase", "3.4.2"
|
27
27
|
```
|
28
28
|
|
29
29
|
And then execute:
|
@@ -139,7 +139,7 @@ Now the API reference is accessible using a web browser (where `VERSION` is the
|
|
139
139
|
|
140
140
|
The gem is available as open source under the terms of the [Apache2 License](https://opensource.org/licenses/Apache-2.0).
|
141
141
|
|
142
|
-
Copyright 2011-
|
142
|
+
Copyright 2011-Present Couchbase, Inc.
|
143
143
|
|
144
144
|
Licensed under the Apache License, Version 2.0 (the "License");
|
145
145
|
you may not use this file except in compliance with the License.
|
data/lib/couchbase/cluster.rb
CHANGED
@@ -32,13 +32,13 @@ module Couchbase
|
|
32
32
|
|
33
33
|
# Connect to the Couchbase cluster
|
34
34
|
#
|
35
|
-
# @overload connect(
|
36
|
-
# @param [String]
|
35
|
+
# @overload connect(connection_string_or_config, options)
|
36
|
+
# @param [String, Configuration] connection_string_or_config connection string used to locate the Couchbase Cluster
|
37
37
|
# @param [Options::Cluster] options custom options when creating the cluster connection
|
38
38
|
#
|
39
|
-
# @overload connect(
|
39
|
+
# @overload connect(connection_string_or_config, username, password, options)
|
40
40
|
# Shortcut for {PasswordAuthenticator}
|
41
|
-
# @param [String]
|
41
|
+
# @param [String] connection_string_or_config connection string used to locate the Couchbase Cluster
|
42
42
|
# @param [String] username name of the user
|
43
43
|
# @param [String] password password of the user
|
44
44
|
# @param [Options::Cluster, nil] options custom options when creating the cluster connection
|
@@ -62,12 +62,16 @@ module Couchbase
|
|
62
62
|
# @see https://docs.couchbase.com/server/current/manage/manage-security/configure-client-certificates.html
|
63
63
|
#
|
64
64
|
# @return [Cluster]
|
65
|
-
def self.connect(
|
66
|
-
|
67
|
-
|
68
|
-
|
65
|
+
def self.connect(connection_string_or_config, *options)
|
66
|
+
connection_string = if connection_string_or_config.is_a?(Configuration)
|
67
|
+
connection_string_or_config.connection_string
|
68
|
+
else
|
69
|
+
connection_string_or_config
|
70
|
+
end
|
71
|
+
if connection_string =~ /\Acouchbases?:\/\/.*\z/i || !connection_string.include?("://")
|
72
|
+
Cluster.new(connection_string_or_config, *options)
|
69
73
|
else
|
70
|
-
ClusterRegistry.instance.connect(
|
74
|
+
ClusterRegistry.instance.connect(connection_string_or_config, *options)
|
71
75
|
end
|
72
76
|
end
|
73
77
|
|
@@ -26,9 +26,14 @@ module Couchbase
|
|
26
26
|
@handlers = {}
|
27
27
|
end
|
28
28
|
|
29
|
-
def connect(
|
29
|
+
def connect(connection_string_or_config, *options)
|
30
|
+
connection_string = if connection_string_or_config.is_a?(Configuration)
|
31
|
+
connection_string_or_config.connection_string
|
32
|
+
else
|
33
|
+
connection_string_or_config
|
34
|
+
end
|
30
35
|
@handlers.each do |regexp, cluster_class|
|
31
|
-
return cluster_class.connect(
|
36
|
+
return cluster_class.connect(connection_string_or_config, *options) if regexp.match?(connection_string)
|
32
37
|
end
|
33
38
|
raise(Error::FeatureNotAvailable, "Connection string '#{connection_string}' not supported.")
|
34
39
|
end
|
@@ -33,10 +33,9 @@ module Couchbase
|
|
33
33
|
private
|
34
34
|
|
35
35
|
def load_configuration(settings)
|
36
|
-
|
37
|
-
@
|
38
|
-
@
|
39
|
-
@password = configuration[:password]
|
36
|
+
@connection_string = settings[:connection_string] || settings["connection_string"]
|
37
|
+
@username = settings[:username] || settings["username"]
|
38
|
+
@password = settings[:password] || settings["password"]
|
40
39
|
end
|
41
40
|
|
42
41
|
def load_yaml(path, environment)
|
Binary file
|
data/lib/couchbase/options.rb
CHANGED
@@ -1029,10 +1029,38 @@ module Couchbase
|
|
1029
1029
|
# Options for {BinaryCollection#append}
|
1030
1030
|
class Append < Base
|
1031
1031
|
attr_accessor :cas # @return [Integer]
|
1032
|
+
attr_accessor :durability_level # @return [Symbol]
|
1033
|
+
attr_accessor :replicate_to # @return [Symbol]
|
1034
|
+
attr_accessor :persist_to # @return [Symbol]
|
1032
1035
|
|
1033
1036
|
# Creates an instance of options for {BinaryCollection#append}
|
1034
1037
|
#
|
1035
1038
|
# @param [Integer] cas The default CAS used (0 means no CAS in this context)
|
1039
|
+
# @param [Symbol] durability_level level of durability
|
1040
|
+
# +:none+::
|
1041
|
+
# no enhanced durability required for the mutation
|
1042
|
+
# +:majority+::
|
1043
|
+
# the mutation must be replicated to a majority of the Data Service nodes
|
1044
|
+
# (that is, held in the memory allocated to the bucket)
|
1045
|
+
# +:majority_and_persist_to_active+::
|
1046
|
+
# The mutation must be replicated to a majority of the Data Service nodes.
|
1047
|
+
# Additionally, it must be persisted (that is, written and synchronised to disk) on the
|
1048
|
+
# node hosting the active partition (vBucket) for the data.
|
1049
|
+
# +:persist_to_majority+::
|
1050
|
+
# The mutation must be persisted to a majority of the Data Service nodes.
|
1051
|
+
# Accordingly, it will be written to disk on those nodes.
|
1052
|
+
# @param [Symbol] replicate_to number of nodes to replicate
|
1053
|
+
# +:none+:: do not apply any replication requirements.
|
1054
|
+
# +:one+:: wait for replication to at least one node.
|
1055
|
+
# +:two+:: wait for replication to at least two nodes.
|
1056
|
+
# +:three+:: wait for replication to at least three nodes.
|
1057
|
+
# @param [Symbol] persist_to number of nodes to persist
|
1058
|
+
# +:none+:: do not apply any persistence requirements.
|
1059
|
+
# +:active+:: wait for persistence to active node
|
1060
|
+
# +:one+:: wait for persistence to at least one node.
|
1061
|
+
# +:two+:: wait for persistence to at least two nodes.
|
1062
|
+
# +:three+:: wait for persistence to at least three nodes.
|
1063
|
+
# +:four+:: wait for persistence to four nodes (active and replicas).
|
1036
1064
|
#
|
1037
1065
|
# @param [Integer, #in_milliseconds, nil] timeout
|
1038
1066
|
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
@@ -1041,12 +1069,23 @@ module Couchbase
|
|
1041
1069
|
#
|
1042
1070
|
# @yieldparam [Append] self
|
1043
1071
|
def initialize(cas: nil,
|
1072
|
+
durability_level: :none,
|
1073
|
+
replicate_to: :none,
|
1074
|
+
persist_to: :none,
|
1044
1075
|
timeout: nil,
|
1045
1076
|
retry_strategy: nil,
|
1046
1077
|
client_context: nil,
|
1047
1078
|
parent_span: nil)
|
1048
1079
|
super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
|
1049
1080
|
@cas = cas
|
1081
|
+
|
1082
|
+
if durability_level != :none && (replicate_to != :none || persist_to != :none)
|
1083
|
+
raise ArgumentError, "durability_level conflicts with replicate_to and persist_to options"
|
1084
|
+
end
|
1085
|
+
|
1086
|
+
@durability_level = durability_level
|
1087
|
+
@replicate_to = replicate_to
|
1088
|
+
@persist_to = persist_to
|
1050
1089
|
yield self if block_given?
|
1051
1090
|
end
|
1052
1091
|
|
@@ -1055,6 +1094,9 @@ module Couchbase
|
|
1055
1094
|
{
|
1056
1095
|
timeout: Utils::Time.extract_duration(@timeout),
|
1057
1096
|
cas: @cas,
|
1097
|
+
durability_level: @durability_level,
|
1098
|
+
persist_to: @persist_to,
|
1099
|
+
replicate_to: @replicate_to,
|
1058
1100
|
}
|
1059
1101
|
end
|
1060
1102
|
|
@@ -1064,12 +1106,39 @@ module Couchbase
|
|
1064
1106
|
|
1065
1107
|
# Options for {BinaryCollection#prepend}
|
1066
1108
|
class Prepend < Base
|
1067
|
-
# @return [Integer]
|
1068
|
-
attr_accessor :
|
1109
|
+
attr_accessor :cas # @return [Integer]
|
1110
|
+
attr_accessor :durability_level # @return [Symbol]
|
1111
|
+
attr_accessor :replicate_to # @return [Symbol]
|
1112
|
+
attr_accessor :persist_to # @return [Symbol]
|
1069
1113
|
|
1070
1114
|
# Creates an instance of options for {BinaryCollection#prepend}
|
1071
1115
|
#
|
1072
1116
|
# @param [Integer] cas The default CAS used (0 means no CAS in this context)
|
1117
|
+
# @param [Symbol] durability_level level of durability
|
1118
|
+
# +:none+::
|
1119
|
+
# no enhanced durability required for the mutation
|
1120
|
+
# +:majority+::
|
1121
|
+
# the mutation must be replicated to a majority of the Data Service nodes
|
1122
|
+
# (that is, held in the memory allocated to the bucket)
|
1123
|
+
# +:majority_and_persist_to_active+::
|
1124
|
+
# The mutation must be replicated to a majority of the Data Service nodes.
|
1125
|
+
# Additionally, it must be persisted (that is, written and synchronised to disk) on the
|
1126
|
+
# node hosting the active partition (vBucket) for the data.
|
1127
|
+
# +:persist_to_majority+::
|
1128
|
+
# The mutation must be persisted to a majority of the Data Service nodes.
|
1129
|
+
# Accordingly, it will be written to disk on those nodes.
|
1130
|
+
# @param [Symbol] replicate_to number of nodes to replicate
|
1131
|
+
# +:none+:: do not apply any replication requirements.
|
1132
|
+
# +:one+:: wait for replication to at least one node.
|
1133
|
+
# +:two+:: wait for replication to at least two nodes.
|
1134
|
+
# +:three+:: wait for replication to at least three nodes.
|
1135
|
+
# @param [Symbol] persist_to number of nodes to persist
|
1136
|
+
# +:none+:: do not apply any persistence requirements.
|
1137
|
+
# +:active+:: wait for persistence to active node
|
1138
|
+
# +:one+:: wait for persistence to at least one node.
|
1139
|
+
# +:two+:: wait for persistence to at least two nodes.
|
1140
|
+
# +:three+:: wait for persistence to at least three nodes.
|
1141
|
+
# +:four+:: wait for persistence to four nodes (active and replicas).
|
1073
1142
|
#
|
1074
1143
|
# @param [Integer, #in_milliseconds, nil] timeout
|
1075
1144
|
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
@@ -1078,12 +1147,23 @@ module Couchbase
|
|
1078
1147
|
#
|
1079
1148
|
# @yieldparam [Prepend] self
|
1080
1149
|
def initialize(cas: nil,
|
1150
|
+
durability_level: :none,
|
1151
|
+
replicate_to: :none,
|
1152
|
+
persist_to: :none,
|
1081
1153
|
timeout: nil,
|
1082
1154
|
retry_strategy: nil,
|
1083
1155
|
client_context: nil,
|
1084
1156
|
parent_span: nil)
|
1085
1157
|
super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
|
1086
1158
|
@cas = cas
|
1159
|
+
|
1160
|
+
if durability_level != :none && (replicate_to != :none || persist_to != :none)
|
1161
|
+
raise ArgumentError, "durability_level conflicts with replicate_to and persist_to options"
|
1162
|
+
end
|
1163
|
+
|
1164
|
+
@durability_level = durability_level
|
1165
|
+
@replicate_to = replicate_to
|
1166
|
+
@persist_to = persist_to
|
1087
1167
|
yield self if block_given?
|
1088
1168
|
end
|
1089
1169
|
|
@@ -1092,6 +1172,9 @@ module Couchbase
|
|
1092
1172
|
{
|
1093
1173
|
timeout: Utils::Time.extract_duration(@timeout),
|
1094
1174
|
cas: @cas,
|
1175
|
+
durability_level: @durability_level,
|
1176
|
+
persist_to: @persist_to,
|
1177
|
+
replicate_to: @replicate_to,
|
1095
1178
|
}
|
1096
1179
|
end
|
1097
1180
|
|
@@ -25,6 +25,16 @@ module Couchbase
|
|
25
25
|
MatchQuery.new(match, &block)
|
26
26
|
end
|
27
27
|
|
28
|
+
# @return [Hash<Symbol, #to_json>]
|
29
|
+
def to_h
|
30
|
+
{}
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [String]
|
34
|
+
def to_json(*args)
|
35
|
+
to_h.to_json(*args)
|
36
|
+
end
|
37
|
+
|
28
38
|
# A match query analyzes the input text and uses that analyzed text to query the index.
|
29
39
|
class MatchQuery < SearchQuery
|
30
40
|
# @return [Float]
|
@@ -53,17 +63,16 @@ module Couchbase
|
|
53
63
|
yield self if block_given?
|
54
64
|
end
|
55
65
|
|
56
|
-
# @return [
|
57
|
-
def
|
58
|
-
data = {
|
59
|
-
data[
|
60
|
-
data[
|
61
|
-
data[
|
62
|
-
if
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
data.to_json(*args)
|
66
|
+
# @return [Hash<Symbol, #to_json>]
|
67
|
+
def to_h
|
68
|
+
data = {:match => @match}
|
69
|
+
data[:boost] = boost if boost
|
70
|
+
data[:field] = field if field
|
71
|
+
data[:analyzer] = analyzer if analyzer
|
72
|
+
data[:operator] = operator if operator
|
73
|
+
data[:fuzziness] = fuzziness if fuzziness
|
74
|
+
data[:prefix_length] = prefix_length if prefix_length
|
75
|
+
data
|
67
76
|
end
|
68
77
|
end
|
69
78
|
|
@@ -82,9 +91,6 @@ module Couchbase
|
|
82
91
|
# @return [Float]
|
83
92
|
attr_accessor :boost
|
84
93
|
|
85
|
-
# @return [nil, :or, :and]
|
86
|
-
attr_accessor :operator
|
87
|
-
|
88
94
|
# @return [String]
|
89
95
|
attr_accessor :field
|
90
96
|
|
@@ -100,14 +106,14 @@ module Couchbase
|
|
100
106
|
yield self if block_given?
|
101
107
|
end
|
102
108
|
|
103
|
-
# @return [
|
104
|
-
def
|
105
|
-
data = {
|
106
|
-
data[
|
107
|
-
data[
|
108
|
-
data[
|
109
|
-
data[
|
110
|
-
data
|
109
|
+
# @return [Hash<Symbol, #to_json>]
|
110
|
+
def to_h
|
111
|
+
data = {:match_phrase => @match_phrase}
|
112
|
+
data[:boost] = boost if boost
|
113
|
+
data[:operator] = operator.to_s if operator
|
114
|
+
data[:field] = field if field
|
115
|
+
data[:analyzer] = analyzer if analyzer
|
116
|
+
data
|
111
117
|
end
|
112
118
|
end
|
113
119
|
|
@@ -126,9 +132,6 @@ module Couchbase
|
|
126
132
|
# @return [Float]
|
127
133
|
attr_accessor :boost
|
128
134
|
|
129
|
-
# @return [nil, :or, :and]
|
130
|
-
attr_accessor :operator
|
131
|
-
|
132
135
|
# @return [String]
|
133
136
|
attr_accessor :field
|
134
137
|
|
@@ -141,13 +144,12 @@ module Couchbase
|
|
141
144
|
yield self if block_given?
|
142
145
|
end
|
143
146
|
|
144
|
-
# @return [
|
145
|
-
def
|
146
|
-
data = {
|
147
|
-
data[
|
148
|
-
data[
|
149
|
-
data
|
150
|
-
data.to_json(*args)
|
147
|
+
# @return [Hash<Symbol, #to_json>]
|
148
|
+
def to_h
|
149
|
+
data = {:regexp => @regexp}
|
150
|
+
data[:boost] = boost if boost
|
151
|
+
data[:field] = field if field
|
152
|
+
data
|
151
153
|
end
|
152
154
|
end
|
153
155
|
|
@@ -166,9 +168,6 @@ module Couchbase
|
|
166
168
|
# @return [Float]
|
167
169
|
attr_accessor :boost
|
168
170
|
|
169
|
-
# @return [nil, :or, :and]
|
170
|
-
attr_accessor :operator
|
171
|
-
|
172
171
|
# @param [String] query_string
|
173
172
|
#
|
174
173
|
# @yieldparam [QueryStringQuery] self
|
@@ -178,12 +177,11 @@ module Couchbase
|
|
178
177
|
yield self if block_given?
|
179
178
|
end
|
180
179
|
|
181
|
-
# @return [
|
182
|
-
def
|
183
|
-
data = {
|
184
|
-
data[
|
185
|
-
data
|
186
|
-
data.to_json(*args)
|
180
|
+
# @return [Hash<Symbol, #to_json>]
|
181
|
+
def to_h
|
182
|
+
data = {:query => @query_string}
|
183
|
+
data[:boost] = boost if boost
|
184
|
+
data
|
187
185
|
end
|
188
186
|
end
|
189
187
|
|
@@ -202,9 +200,6 @@ module Couchbase
|
|
202
200
|
# @return [Float]
|
203
201
|
attr_accessor :boost
|
204
202
|
|
205
|
-
# @return [nil, :or, :and]
|
206
|
-
attr_accessor :operator
|
207
|
-
|
208
203
|
# @return [String]
|
209
204
|
attr_accessor :field
|
210
205
|
|
@@ -217,13 +212,12 @@ module Couchbase
|
|
217
212
|
yield self if block_given?
|
218
213
|
end
|
219
214
|
|
220
|
-
# @return [
|
221
|
-
def
|
222
|
-
data = {
|
223
|
-
data[
|
224
|
-
data[
|
225
|
-
data
|
226
|
-
data.to_json(*args)
|
215
|
+
# @return [Hash<Symbol, #to_json>]
|
216
|
+
def to_h
|
217
|
+
data = {:wildcard => @wildcard}
|
218
|
+
data[:boost] = boost if boost
|
219
|
+
data[:field] = field if field
|
220
|
+
data
|
227
221
|
end
|
228
222
|
end
|
229
223
|
|
@@ -242,12 +236,6 @@ module Couchbase
|
|
242
236
|
# @return [Float]
|
243
237
|
attr_accessor :boost
|
244
238
|
|
245
|
-
# @return [nil, :or, :and]
|
246
|
-
attr_accessor :operator
|
247
|
-
|
248
|
-
# @return [String]
|
249
|
-
attr_accessor :field
|
250
|
-
|
251
239
|
# @param [String...] doc_ids
|
252
240
|
#
|
253
241
|
# @yieldparam [DocIdQuery] self
|
@@ -257,13 +245,11 @@ module Couchbase
|
|
257
245
|
yield self if block_given?
|
258
246
|
end
|
259
247
|
|
260
|
-
# @return [
|
261
|
-
def
|
262
|
-
data = {
|
263
|
-
data[
|
264
|
-
data
|
265
|
-
data["field"] = field if field
|
266
|
-
data.to_json(*args)
|
248
|
+
# @return [Hash<Symbol, #to_json>]
|
249
|
+
def to_h
|
250
|
+
data = {:ids => @doc_ids.flatten.uniq}
|
251
|
+
data[:boost] = boost if boost
|
252
|
+
data
|
267
253
|
end
|
268
254
|
end
|
269
255
|
|
@@ -282,9 +268,6 @@ module Couchbase
|
|
282
268
|
# @return [Float]
|
283
269
|
attr_accessor :boost
|
284
270
|
|
285
|
-
# @return [nil, :or, :and]
|
286
|
-
attr_accessor :operator
|
287
|
-
|
288
271
|
# @return [String]
|
289
272
|
attr_accessor :field
|
290
273
|
|
@@ -297,13 +280,12 @@ module Couchbase
|
|
297
280
|
yield self if block_given?
|
298
281
|
end
|
299
282
|
|
300
|
-
# @return [
|
301
|
-
def
|
302
|
-
data = {
|
303
|
-
data[
|
304
|
-
data[
|
305
|
-
data
|
306
|
-
data.to_json(*args)
|
283
|
+
# @return [Hash<Symbol, #to_json>]
|
284
|
+
def to_h
|
285
|
+
data = {:bool => @value}
|
286
|
+
data[:boost] = boost if boost
|
287
|
+
data[:field] = field if field
|
288
|
+
data
|
307
289
|
end
|
308
290
|
end
|
309
291
|
|
@@ -321,9 +303,6 @@ module Couchbase
|
|
321
303
|
# @return [Float]
|
322
304
|
attr_accessor :boost
|
323
305
|
|
324
|
-
# @return [nil, :or, :and]
|
325
|
-
attr_accessor :operator
|
326
|
-
|
327
306
|
# @return [String]
|
328
307
|
attr_accessor :field
|
329
308
|
|
@@ -365,32 +344,31 @@ module Couchbase
|
|
365
344
|
|
366
345
|
DATE_FORMAT_RFC3339 = "%Y-%m-%dT%H:%M:%S%:z".freeze
|
367
346
|
|
368
|
-
# @return [
|
369
|
-
def
|
347
|
+
# @return [Hash<Symbol, #to_json>]
|
348
|
+
def to_h
|
370
349
|
raise ArgumentError, "either start_time or end_time must be set for DateRangeQuery" if @start_time.nil? && @end_time.nil?
|
371
350
|
|
372
351
|
data = {}
|
373
|
-
data[
|
374
|
-
data[
|
375
|
-
data[
|
376
|
-
data["datetime_parser"] = date_time_parser if date_time_parser
|
352
|
+
data[:boost] = boost if boost
|
353
|
+
data[:field] = field if field
|
354
|
+
data[:datetime_parser] = date_time_parser if date_time_parser
|
377
355
|
if @start_time
|
378
|
-
data[
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
data[
|
356
|
+
data[:start] = if @start_time.respond_to?(:strftime)
|
357
|
+
@start_time.strftime(DATE_FORMAT_RFC3339)
|
358
|
+
else
|
359
|
+
@start_time
|
360
|
+
end
|
361
|
+
data[:inclusive_start] = @start_inclusive unless @start_inclusive.nil?
|
384
362
|
end
|
385
363
|
if @end_time
|
386
|
-
data[
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
data[
|
364
|
+
data[:end] = if @end_time.respond_to?(:strftime)
|
365
|
+
@end_time.strftime(DATE_FORMAT_RFC3339)
|
366
|
+
else
|
367
|
+
@end_time
|
368
|
+
end
|
369
|
+
data[:inclusive_end] = @end_inclusive unless @end_inclusive.nil?
|
392
370
|
end
|
393
|
-
data
|
371
|
+
data
|
394
372
|
end
|
395
373
|
end
|
396
374
|
|
@@ -408,9 +386,6 @@ module Couchbase
|
|
408
386
|
# @return [Float]
|
409
387
|
attr_accessor :boost
|
410
388
|
|
411
|
-
# @return [nil, :or, :and]
|
412
|
-
attr_accessor :operator
|
413
|
-
|
414
389
|
# @return [String]
|
415
390
|
attr_accessor :field
|
416
391
|
|
@@ -446,23 +421,22 @@ module Couchbase
|
|
446
421
|
yield self if block_given?
|
447
422
|
end
|
448
423
|
|
449
|
-
# @return [
|
450
|
-
def
|
424
|
+
# @return [Hash<Symbol, #to_json>]
|
425
|
+
def to_h
|
451
426
|
raise ArgumentError, "either min or max must be set for NumericRangeQuery" if @min.nil? && @max.nil?
|
452
427
|
|
453
428
|
data = {}
|
454
|
-
data[
|
455
|
-
data[
|
456
|
-
data["field"] = field if field
|
429
|
+
data[:boost] = boost if boost
|
430
|
+
data[:field] = field if field
|
457
431
|
if @min
|
458
|
-
data[
|
459
|
-
data[
|
432
|
+
data[:min] = @min
|
433
|
+
data[:inclusive_min] = @min_inclusive unless @min_inclusive.nil?
|
460
434
|
end
|
461
435
|
if @max
|
462
|
-
data[
|
463
|
-
data[
|
436
|
+
data[:max] = @max
|
437
|
+
data[:inclusive_max] = @max_inclusive unless @max_inclusive.nil?
|
464
438
|
end
|
465
|
-
data
|
439
|
+
data
|
466
440
|
end
|
467
441
|
end
|
468
442
|
|
@@ -480,9 +454,6 @@ module Couchbase
|
|
480
454
|
# @return [Float]
|
481
455
|
attr_accessor :boost
|
482
456
|
|
483
|
-
# @return [nil, :or, :and]
|
484
|
-
attr_accessor :operator
|
485
|
-
|
486
457
|
# @return [String]
|
487
458
|
attr_accessor :field
|
488
459
|
|
@@ -518,23 +489,22 @@ module Couchbase
|
|
518
489
|
yield self if block_given?
|
519
490
|
end
|
520
491
|
|
521
|
-
# @return [
|
522
|
-
def
|
492
|
+
# @return [Hash<Symbol, #to_json>]
|
493
|
+
def to_h
|
523
494
|
raise ArgumentError, "either min or max must be set for TermRangeQuery" if @min.nil? && @max.nil?
|
524
495
|
|
525
496
|
data = {}
|
526
|
-
data[
|
527
|
-
data[
|
528
|
-
data["field"] = field if field
|
497
|
+
data[:boost] = boost if boost
|
498
|
+
data[:field] = field if field
|
529
499
|
if @min
|
530
|
-
data[
|
531
|
-
data[
|
500
|
+
data[:min] = @min
|
501
|
+
data[:inclusive_min] = @min_inclusive unless @min_inclusive.nil?
|
532
502
|
end
|
533
503
|
if @max
|
534
|
-
data[
|
535
|
-
data[
|
504
|
+
data[:max] = @max
|
505
|
+
data[:inclusive_max] = @max_inclusive unless @max_inclusive.nil?
|
536
506
|
end
|
537
|
-
data
|
507
|
+
data
|
538
508
|
end
|
539
509
|
end
|
540
510
|
|
@@ -556,9 +526,6 @@ module Couchbase
|
|
556
526
|
# @return [Float]
|
557
527
|
attr_accessor :boost
|
558
528
|
|
559
|
-
# @return [nil, :or, :and]
|
560
|
-
attr_accessor :operator
|
561
|
-
|
562
529
|
# @return [String]
|
563
530
|
attr_accessor :field
|
564
531
|
|
@@ -574,16 +541,15 @@ module Couchbase
|
|
574
541
|
yield self if block_given?
|
575
542
|
end
|
576
543
|
|
577
|
-
# @return [
|
578
|
-
def
|
544
|
+
# @return [Hash<Symbol, #to_json>]
|
545
|
+
def to_h
|
579
546
|
data = {
|
580
|
-
|
581
|
-
|
547
|
+
:location => [@longitude, @latitude],
|
548
|
+
:distance => @distance,
|
582
549
|
}
|
583
|
-
data[
|
584
|
-
data[
|
585
|
-
data
|
586
|
-
data.to_json(*args)
|
550
|
+
data[:boost] = boost if boost
|
551
|
+
data[:field] = field if field
|
552
|
+
data
|
587
553
|
end
|
588
554
|
end
|
589
555
|
|
@@ -606,9 +572,6 @@ module Couchbase
|
|
606
572
|
# @return [Float]
|
607
573
|
attr_accessor :boost
|
608
574
|
|
609
|
-
# @return [nil, :or, :and]
|
610
|
-
attr_accessor :operator
|
611
|
-
|
612
575
|
# @return [String]
|
613
576
|
attr_accessor :field
|
614
577
|
|
@@ -627,16 +590,15 @@ module Couchbase
|
|
627
590
|
yield self if block_given?
|
628
591
|
end
|
629
592
|
|
630
|
-
# @return [
|
631
|
-
def
|
593
|
+
# @return [Hash<Symbol, #to_json>]
|
594
|
+
def to_h
|
632
595
|
data = {
|
633
|
-
|
634
|
-
|
596
|
+
:top_left => [@top_left_longitude, @top_left_latitude],
|
597
|
+
:bottom_right => [@bottom_right_longitude, @bottom_right_latitude],
|
635
598
|
}
|
636
|
-
data[
|
637
|
-
data[
|
638
|
-
data
|
639
|
-
data.to_json(*args)
|
599
|
+
data[:boost] = boost if boost
|
600
|
+
data[:field] = field if field
|
601
|
+
data
|
640
602
|
end
|
641
603
|
end
|
642
604
|
|
@@ -675,9 +637,6 @@ module Couchbase
|
|
675
637
|
# @return [Float]
|
676
638
|
attr_accessor :boost
|
677
639
|
|
678
|
-
# @return [nil, :or, :and]
|
679
|
-
attr_accessor :operator
|
680
|
-
|
681
640
|
# @return [String]
|
682
641
|
attr_accessor :field
|
683
642
|
|
@@ -690,15 +649,14 @@ module Couchbase
|
|
690
649
|
yield self if block_given?
|
691
650
|
end
|
692
651
|
|
693
|
-
# @return [
|
694
|
-
def
|
652
|
+
# @return [Hash<Symbol, #to_json>]
|
653
|
+
def to_h
|
695
654
|
data = {
|
696
|
-
|
655
|
+
:polygon_points => @coordinates.map { |coord| [coord.longitude, coord.latitude] },
|
697
656
|
}
|
698
|
-
data[
|
699
|
-
data[
|
700
|
-
data
|
701
|
-
data.to_json(*args)
|
657
|
+
data[:boost] = boost if boost
|
658
|
+
data[:field] = field if field
|
659
|
+
data
|
702
660
|
end
|
703
661
|
end
|
704
662
|
|
@@ -716,9 +674,6 @@ module Couchbase
|
|
716
674
|
# @return [Float]
|
717
675
|
attr_accessor :boost
|
718
676
|
|
719
|
-
# @return [nil, :or, :and]
|
720
|
-
attr_accessor :operator
|
721
|
-
|
722
677
|
# @yieldparam [ConjunctionQuery] self
|
723
678
|
#
|
724
679
|
# @param [*SearchQuery] queries
|
@@ -737,22 +692,21 @@ module Couchbase
|
|
737
692
|
@queries.empty?
|
738
693
|
end
|
739
694
|
|
740
|
-
# @return [
|
741
|
-
def
|
695
|
+
# @return [Hash<Symbol, #to_json>]
|
696
|
+
def to_h
|
742
697
|
raise ArgumentError, "compound conjunction query must have sub-queries" if @queries.nil? || @queries.empty?
|
743
698
|
|
744
|
-
data = {
|
745
|
-
data[
|
746
|
-
data
|
747
|
-
data.to_json(*args)
|
699
|
+
data = {:conjuncts => @queries.uniq.map(&:to_h)}
|
700
|
+
data[:boost] = boost if boost
|
701
|
+
data
|
748
702
|
end
|
749
703
|
end
|
750
704
|
|
751
705
|
# Prepare {ConjunctionQuery} body
|
752
706
|
#
|
753
|
-
# @yieldparam [
|
707
|
+
# @yieldparam [DisjunctionQuery] query
|
754
708
|
#
|
755
|
-
# @return [
|
709
|
+
# @return [DisjunctionQuery]
|
756
710
|
def self.disjuncts(...)
|
757
711
|
DisjunctionQuery.new(...)
|
758
712
|
end
|
@@ -762,9 +716,6 @@ module Couchbase
|
|
762
716
|
# @return [Float]
|
763
717
|
attr_accessor :boost
|
764
718
|
|
765
|
-
# @return [nil, :or, :and]
|
766
|
-
attr_accessor :operator
|
767
|
-
|
768
719
|
# @return [Integer]
|
769
720
|
attr_accessor :min
|
770
721
|
|
@@ -786,19 +737,18 @@ module Couchbase
|
|
786
737
|
@queries.empty?
|
787
738
|
end
|
788
739
|
|
789
|
-
# @return [
|
790
|
-
def
|
740
|
+
# @return [Hash<Symbol, #to_json>]
|
741
|
+
def to_h
|
791
742
|
raise ArgumentError, "compound disjunction query must have sub-queries" if @queries.nil? || @queries.empty?
|
792
743
|
|
793
|
-
data = {
|
744
|
+
data = {:disjuncts => @queries.uniq.map(&:to_h)}
|
794
745
|
if min
|
795
746
|
raise ArgumentError, "disjunction query has fewer sub-queries than configured minimum" if @queries.size < min
|
796
747
|
|
797
|
-
data[
|
748
|
+
data[:min] = min
|
798
749
|
end
|
799
|
-
data[
|
800
|
-
data
|
801
|
-
data.to_json(*args)
|
750
|
+
data[:boost] = boost if boost
|
751
|
+
data
|
802
752
|
end
|
803
753
|
end
|
804
754
|
|
@@ -816,9 +766,6 @@ module Couchbase
|
|
816
766
|
# @return [Float]
|
817
767
|
attr_accessor :boost
|
818
768
|
|
819
|
-
# @return [nil, :or, :and]
|
820
|
-
attr_accessor :operator
|
821
|
-
|
822
769
|
# @yieldparam [BooleanQuery] self
|
823
770
|
def initialize
|
824
771
|
super()
|
@@ -852,19 +799,18 @@ module Couchbase
|
|
852
799
|
self
|
853
800
|
end
|
854
801
|
|
855
|
-
# @return [
|
856
|
-
def
|
802
|
+
# @return [Hash<Symbol, #to_json>]
|
803
|
+
def to_h
|
857
804
|
if @must.empty? && @must_not.empty? && @should.empty?
|
858
805
|
raise ArgumentError, "BooleanQuery must have at least one non-empty sub-query"
|
859
806
|
end
|
860
807
|
|
861
808
|
data = {}
|
862
|
-
data[
|
863
|
-
data[
|
864
|
-
data[
|
865
|
-
data[
|
866
|
-
data
|
867
|
-
data.to_json(*args)
|
809
|
+
data[:must] = @must.to_h unless @must.empty?
|
810
|
+
data[:must_not] = @must_not.to_h unless @must_not.empty?
|
811
|
+
data[:should] = @should.to_h unless @should.empty?
|
812
|
+
data[:boost] = boost if boost
|
813
|
+
data
|
868
814
|
end
|
869
815
|
end
|
870
816
|
|
@@ -884,9 +830,6 @@ module Couchbase
|
|
884
830
|
# @return [Float]
|
885
831
|
attr_accessor :boost
|
886
832
|
|
887
|
-
# @return [nil, :or, :and]
|
888
|
-
attr_accessor :operator
|
889
|
-
|
890
833
|
# @return [String]
|
891
834
|
attr_accessor :field
|
892
835
|
|
@@ -905,18 +848,16 @@ module Couchbase
|
|
905
848
|
yield self if block_given?
|
906
849
|
end
|
907
850
|
|
908
|
-
# @return [
|
909
|
-
def
|
910
|
-
data = {
|
911
|
-
data[
|
912
|
-
data[
|
913
|
-
data["operator"] = operator.to_s if operator
|
914
|
-
data["field"] = field if field
|
851
|
+
# @return [Hash<Symbol, #to_json>]
|
852
|
+
def to_h
|
853
|
+
data = {:term => @term}
|
854
|
+
data[:boost] = boost if boost
|
855
|
+
data[:field] = field if field
|
915
856
|
if fuzziness
|
916
|
-
data[
|
917
|
-
data[
|
857
|
+
data[:fuzziness] = fuzziness
|
858
|
+
data[:prefix_length] = prefix_length if prefix_length
|
918
859
|
end
|
919
|
-
data
|
860
|
+
data
|
920
861
|
end
|
921
862
|
end
|
922
863
|
|
@@ -950,13 +891,12 @@ module Couchbase
|
|
950
891
|
yield self if block_given?
|
951
892
|
end
|
952
893
|
|
953
|
-
# @return [
|
954
|
-
def
|
955
|
-
data = {
|
956
|
-
data[
|
957
|
-
data[
|
958
|
-
data
|
959
|
-
data.to_json(*args)
|
894
|
+
# @return [Hash<Symbol, #to_json>]
|
895
|
+
def to_h
|
896
|
+
data = {:prefix => @prefix}
|
897
|
+
data[:boost] = boost if boost
|
898
|
+
data[:field] = field if field
|
899
|
+
data
|
960
900
|
end
|
961
901
|
end
|
962
902
|
|
@@ -975,9 +915,6 @@ module Couchbase
|
|
975
915
|
# @return [Float]
|
976
916
|
attr_accessor :boost
|
977
917
|
|
978
|
-
# @return [nil, :or, :and]
|
979
|
-
attr_accessor :operator
|
980
|
-
|
981
918
|
# @return [String]
|
982
919
|
attr_accessor :field
|
983
920
|
|
@@ -990,13 +927,12 @@ module Couchbase
|
|
990
927
|
yield self if block_given?
|
991
928
|
end
|
992
929
|
|
993
|
-
# @return [
|
994
|
-
def
|
995
|
-
data = {
|
996
|
-
data[
|
997
|
-
data[
|
998
|
-
data
|
999
|
-
data.to_json(*args)
|
930
|
+
# @return [Hash<Symbol, #to_json>]
|
931
|
+
def to_h
|
932
|
+
data = {:terms => @terms.flatten.uniq}
|
933
|
+
data[:boost] = boost if boost
|
934
|
+
data[:field] = field if field
|
935
|
+
data
|
1000
936
|
end
|
1001
937
|
end
|
1002
938
|
|
@@ -1011,24 +947,15 @@ module Couchbase
|
|
1011
947
|
|
1012
948
|
# A query that matches all indexed documents.
|
1013
949
|
class MatchAllQuery < SearchQuery
|
1014
|
-
# @return [Float]
|
1015
|
-
attr_accessor :boost
|
1016
|
-
|
1017
|
-
# @return [nil, :or, :and]
|
1018
|
-
attr_accessor :operator
|
1019
|
-
|
1020
950
|
# @yieldparam [MatchAllQuery] self
|
1021
951
|
def initialize
|
1022
952
|
super()
|
1023
953
|
yield self if block_given?
|
1024
954
|
end
|
1025
955
|
|
1026
|
-
# @return [
|
1027
|
-
def
|
1028
|
-
|
1029
|
-
data["boost"] = boost if boost
|
1030
|
-
data["operator"] = operator.to_s if operator
|
1031
|
-
data.to_json(*args)
|
956
|
+
# @return [Hash<Symbol, #to_json>]
|
957
|
+
def to_h
|
958
|
+
{:match_all => nil}
|
1032
959
|
end
|
1033
960
|
end
|
1034
961
|
|
@@ -1043,24 +970,15 @@ module Couchbase
|
|
1043
970
|
|
1044
971
|
# A query that matches nothing.
|
1045
972
|
class MatchNoneQuery < SearchQuery
|
1046
|
-
# @return [Float]
|
1047
|
-
attr_accessor :boost
|
1048
|
-
|
1049
|
-
# @return [nil, :or, :and]
|
1050
|
-
attr_accessor :operator
|
1051
|
-
|
1052
973
|
# @yieldparam [MatchNoneQuery] self
|
1053
974
|
def initialize
|
1054
975
|
super()
|
1055
976
|
yield self if block_given?
|
1056
977
|
end
|
1057
978
|
|
1058
|
-
# @return [
|
1059
|
-
def
|
1060
|
-
|
1061
|
-
data["boost"] = boost if boost
|
1062
|
-
data["operator"] = operator.to_s if operator
|
1063
|
-
data.to_json(*args)
|
979
|
+
# @return [Hash<Symbol, #to_json>]
|
980
|
+
def to_h
|
981
|
+
{:match_none => nil}
|
1064
982
|
end
|
1065
983
|
end
|
1066
984
|
end
|
data/lib/couchbase/version.rb
CHANGED
@@ -19,5 +19,5 @@ module Couchbase
|
|
19
19
|
# $ ruby -rcouchbase -e 'pp Couchbase::VERSION'
|
20
20
|
# {:sdk=>"3.4.0", :ruby_abi=>"3.1.0", :revision=>"416fe68e6029ec8a4c40611cf6e6b30d3b90d20f"}
|
21
21
|
VERSION = {} unless defined?(VERSION) # rubocop:disable Style/MutableConstant
|
22
|
-
VERSION.update(:sdk => "3.4.
|
22
|
+
VERSION.update(:sdk => "3.4.2".freeze)
|
23
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: couchbase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.2
|
5
5
|
platform: arm64-darwin-20
|
6
6
|
authors:
|
7
7
|
- Sergey Avseyev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Modern SDK for Couchbase Server
|
14
14
|
email:
|
@@ -73,9 +73,9 @@ metadata:
|
|
73
73
|
homepage_uri: https://docs.couchbase.com/ruby-sdk/current/hello-world/start-using-sdk.html
|
74
74
|
bug_tracker_uri: https://couchbase.com/issues/browse/RCBC
|
75
75
|
mailing_list_uri: https://forums.couchbase.com/c/ruby-sdk
|
76
|
-
source_code_uri: https://github.com/couchbase/couchbase-ruby-client/tree/3.4.
|
77
|
-
changelog_uri: https://github.com/couchbase/couchbase-ruby-client/releases/tag/3.4.
|
78
|
-
documentation_uri: https://docs.couchbase.com/sdk-api/couchbase-ruby-client-3.4.
|
76
|
+
source_code_uri: https://github.com/couchbase/couchbase-ruby-client/tree/3.4.2
|
77
|
+
changelog_uri: https://github.com/couchbase/couchbase-ruby-client/releases/tag/3.4.2
|
78
|
+
documentation_uri: https://docs.couchbase.com/sdk-api/couchbase-ruby-client-3.4.2/index.html
|
79
79
|
github_repo: ssh://github.com/couchbase/couchbase-ruby-client
|
80
80
|
rubygems_mfa_required: 'true'
|
81
81
|
post_install_message:
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
|
-
rubygems_version: 3.4.
|
98
|
+
rubygems_version: 3.4.10
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: SDK for Couchbase Server
|