Matthias Brantner has proposed merging
lp:~zorba-coders/zorba/couchbase_module-bug-1188063 into
lp:zorba/couchbase-module.
Commit message:
renamed to zorba.io and adapted documentation
Requested reviews:
Matthias Brantner (matthias-brantner)
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/couchbase_module-bug-1188063/+merge/182781
--
https://code.launchpad.net/~zorba-coders/zorba/couchbase_module-bug-1188063/+merge/182781
Your team Zorba Coders is subscribed to branch lp:zorba/couchbase-module.
=== modified file 'src/couchbase.xq'
--- src/couchbase.xq 2013-08-09 09:37:05 +
+++ src/couchbase.xq 2013-08-28 23:18:04 +
@@ -1,7 +1,7 @@
-xquery version "3.0";
+jsoniq version "1.0";
(:
- : Copyright 2012 The FLWOR Foundation.
+ : Copyright 2013 The FLWOR Foundation.
:
: Licensed under the Apache License, Version 2.0 (the "License");
: you may not use this file except in compliance with the License.
@@ -19,9 +19,9 @@
(:~
: This module provides minimal functionality to interact with the
: Couchbase NoSQL database.
- :
+ :
: The module is built using the libcouchbase C client library and
- : exposes most of its functionality in XQuery with JSONiq extensions.
+ : exposes most of its functionality.
: Beyond just allowing for basic key-value store operations (e.g.
: put-/get-text or put-/get-binary, this module also allows to work
: with Couchbase views in order to allow for complex JSON query
@@ -31,9 +31,8 @@
: @project DB Drivers/Couchbase
:
:)
-module namespace cb = "http://www.zorba-xquery.com/modules/couchbase";;
+module namespace cb = "http://zorba.io/modules/couchbase";;
-declare namespace jn = "http://jsoniq.org/functions";;
declare namespace an = "http://zorba.io/annotations";;
declare namespace ver = "http://zorba.io/options/versioning";;
@@ -55,11 +54,11 @@
:)
declare %an:sequential function cb:connect(
- $host as xs:string,
- $username as xs:string?,
- $password as xs:string?,
- $bucket as xs:string)
-as xs:anyURI
+ $host as string,
+ $username as string?,
+ $password as string?,
+ $bucket as string)
+as anyURI
{
cb:connect({"host" : $host,
"username" : $username,
@@ -71,13 +70,8 @@
: Connect to the Couchbase server and return an opaque identifier
: representing the established connection.
:
- : @param $options a JSONiq object that contains the host, bucket,
- : and user information.
- :
- : @option "host" endpoint of the Couchbase server (mandatory)
- : @option "username" username used for the connection (optional)
- : @option "password" password used for the connection (optional)
- : @option "bucket" name of an existing bucket (mandatory)
+ : @param $options an object that contains the host (mandatory),
+ : bucket (mandatory), username, and password.
:
: @error cb:LCB0001 if the connection to the given host/bucket
: could not be established.
@@ -85,22 +79,12 @@
: @error cb:CB0007 if a given option is not supported.
:
: @return an identifier for the established connection.
- :
- : Example:
- :
- : {
- : "host": "localhost:8091",
- : "username" : null,
- : "password" : null,
- : "bucket" : "default"
- : }
- :
:)
-declare %an:sequential function cb:connect($options as object())
-as xs:anyURI external;
+declare %an:sequential function cb:connect($options as object)
+as anyURI external;
(:~
- : Return the values of the given keys (type xs:string) as string.
+ : Return the values of the given keys as string.
:
: @param $db connection reference
: @param $key the requested keys
@@ -108,43 +92,39 @@
: @error cb:LCB0002 if any error occurs in the communication with
: the server.
:
- : @return A sequence of string Items corresponding to the key
+ : @return A sequence of strings.
:)
declare %an:sequential function cb:get-text(
- $db as xs:anyURI,
- $key as xs:string*)
-as xs:string* external;
+ $db as anyURI,
+ $key as string*)
+as string* external;
(:~
- : Return the values of the given keys (type xs:string) as string.
+ : Return the values of the given keys as string.
:
: @param $db connection reference
: @param $key the requested keys
- : @param $options JSONiq object with additional options
+ : @param $options an object specifying the expiration-time (integer)
+ : or encoding (string; default is UTF-8).
:
- : @option "expiration-time" xs:integer value for refreshing the expiration
- : time in seconds.
- : @option "encoding" string with the name of the encoding of the returned
- : string (if not UTF-8).
- :
: @error cb:LCB0002 if any error occurs in the communication with
: the server.
: @error cb:CB0006 if the given encoding is not supported.
: @error cb:CB0007 if any of the options is not supported.
- : @error cb:CB0009 if the given expiration time is not an xs:integer.
+ : @error cb:CB0009 if the given expiration time is not an integer.
:
: @return a sequence of strings for the given keys.