libcouchbase 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/README.md +64 -0
- data/lib/libcouchbase/connection.rb +2 -1
- data/lib/libcouchbase/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c7026a453499153eecaf17905759b204cec170c
|
4
|
+
data.tar.gz: b46e74fd72718803d075fb1afa7ea348fe7b7079
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37a4e81b2fae232db4e7e74e4d0966cbce04a695f7e7f0966f067331b882f8e022b60c1742c7289ee1f371a368daab93a36c48ff3cbeb0de5872e6fda88e1b1c
|
7
|
+
data.tar.gz: 5d4f5a2e4e8f24ff3a0a025b94a3a016831cb2717d57c13bb4ebf7b36f043bb139282722172b4927b94c4237e5fdcc77c433d4f6df8056f09b7c41afd1490979
|
data/.travis.yml
CHANGED
@@ -16,10 +16,10 @@ before_install:
|
|
16
16
|
- sudo apt-get install libev-dev python-httplib2
|
17
17
|
- sudo wget https://packages.couchbase.com/releases/5.0.0/couchbase-server-enterprise_5.0.0-ubuntu14.04_amd64.deb
|
18
18
|
- sudo dpkg -i couchbase-server-enterprise_5.0.0-ubuntu14.04_amd64.deb
|
19
|
-
- sleep
|
19
|
+
- sleep 8
|
20
20
|
- sudo service couchbase-server status
|
21
21
|
- /opt/couchbase/bin/couchbase-cli cluster-init -c 127.0.0.1:8091 --cluster-username=admin --cluster-password=password --cluster-ramsize=320 --cluster-index-ramsize=256 --cluster-fts-ramsize=256 --services=data,index,query,fts
|
22
|
-
- sleep
|
22
|
+
- sleep 5
|
23
23
|
- /opt/couchbase/bin/couchbase-cli server-info -c 127.0.0.1:8091 -u admin -p password
|
24
24
|
- /opt/couchbase/bin/couchbase-cli bucket-create -c 127.0.0.1:8091 -u admin -p password --bucket=default --bucket-type=couchbase --bucket-ramsize=160 --bucket-replica=0 --wait
|
25
25
|
- /opt/couchbase/bin/couchbase-cli bucket-create -c 127.0.0.1:8091 -u admin -p password --bucket=test --bucket-type=couchbase --bucket-ramsize=160 --bucket-replica=0 --enable-flush=1 --wait
|
data/README.md
CHANGED
@@ -261,6 +261,70 @@ Delete all items in the bucket. This must be enabled on the cluster to work
|
|
261
261
|
bucket.flush
|
262
262
|
```
|
263
263
|
|
264
|
+
### Subdocument queries
|
265
|
+
|
266
|
+
These allow you to modify keys within documents. There is a block form.
|
267
|
+
|
268
|
+
```ruby
|
269
|
+
c.subdoc(:foo) { |subdoc|
|
270
|
+
subdoc.get('sub.key')
|
271
|
+
subdoc.exists?('other.key')
|
272
|
+
subdoc.get_count('some.array')
|
273
|
+
} # => ["sub key val", true, 23]
|
274
|
+
```
|
275
|
+
|
276
|
+
There is an inline form
|
277
|
+
|
278
|
+
```ruby
|
279
|
+
c.subdoc(:foo).get(:bob).execute! # => { age: 13, working: false }
|
280
|
+
c.subdoc(:foo)
|
281
|
+
.get(:bob)
|
282
|
+
.get(:jane)
|
283
|
+
.execute! # => [{ age: 13, working: false }, { age: 47, working: true }]
|
284
|
+
```
|
285
|
+
|
286
|
+
You can't perform lookups and mutations in the same request.
|
287
|
+
|
288
|
+
```ruby
|
289
|
+
# multi-mutation example
|
290
|
+
c.subdoc(:foo)
|
291
|
+
.counter('bob.age', 1)
|
292
|
+
.dict_upsert('bob.address', {
|
293
|
+
number: 23
|
294
|
+
street: 'Daily Ave'
|
295
|
+
suburb: 'Some Town'
|
296
|
+
}).execute! # => 14 (the new counter value)
|
297
|
+
```
|
298
|
+
|
299
|
+
By default, subkeys are created if they don't exist
|
300
|
+
|
301
|
+
```ruby
|
302
|
+
c.put(:some_key, {name: 'bob'})
|
303
|
+
c.subdoc(:some_key).dict_add('non.existant.key', {
|
304
|
+
random: 123,
|
305
|
+
hash: 'values'
|
306
|
+
}).execute!
|
307
|
+
```
|
308
|
+
|
309
|
+
Possible lookup operations are:
|
310
|
+
|
311
|
+
* `get`
|
312
|
+
* `exists?`
|
313
|
+
* `get_count`
|
314
|
+
|
315
|
+
Possible mutation operations
|
316
|
+
|
317
|
+
* `counter` increments the subkey by integer value passed
|
318
|
+
* `dict_upsert` replaces the subkey with value passed
|
319
|
+
* `dict_add`
|
320
|
+
* `array_add_first`
|
321
|
+
* `array_add_last`
|
322
|
+
* `array_add_unique`
|
323
|
+
* `array_insert`
|
324
|
+
* `replace`
|
325
|
+
|
326
|
+
You can see additional docs here: https://developer.couchbase.com/documentation/server/current/sdk/subdocument-operations.html
|
327
|
+
|
264
328
|
|
265
329
|
### Views (Map/Reduce queries)
|
266
330
|
|
@@ -97,7 +97,8 @@ module Libcouchbase
|
|
97
97
|
@connection = Ext::CreateSt.new
|
98
98
|
@connection[:version] = 3
|
99
99
|
@connection[:v][:v3][:connstr] = FFI::MemoryPointer.from_string(connstr)
|
100
|
-
|
100
|
+
uname = (username && !username.to_s.empty?) ? username.to_s : bucket.to_s
|
101
|
+
@connection[:v][:v3][:username] = FFI::MemoryPointer.from_string(uname)
|
101
102
|
@connection[:v][:v3][:passwd] = FFI::MemoryPointer.from_string(password) if password
|
102
103
|
@connection[:v][:v3][:io] = @io_ptr.get_pointer(0)
|
103
104
|
@handle_ptr = FFI::MemoryPointer.new :pointer, 1
|
data/lib/libcouchbase/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libcouchbase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen von Takach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|