Skip to content

Commit

Permalink
Merge pull request #28 from joewiz/fix-map-constructor-syntax
Browse files Browse the repository at this point in the history
Fix map constructor syntax
  • Loading branch information
line-o authored Jul 23, 2019
2 parents 0d44dc4 + 99a384a commit dddfd3c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions examples/contacts/contacts.xql
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ declare variable $contacts:HTTP-SERVER-FAIL as xs:integer := 500; (: server side
(: map client side exception to http code :)
declare variable $contacts:CLIENT-EXCEPTION-MAP := map
{
'ResourceNotFound' := $contacts:HTTP-NOT-FOUND,
'ExternalResourceNotFound' := $contacts:HTTP-NOT-FOUND,
'InvalidJson' := $contacts:HTTP-CLIENT-FAIL,
'InvalidModel' := $contacts:HTTP-CLIENT-FAIL,
'MissingProperty' := $contacts:HTTP-CLIENT-FAIL,
'*' := $contacts:HTTP-CLIENT-FAIL
'ResourceNotFound': $contacts:HTTP-NOT-FOUND,
'ExternalResourceNotFound': $contacts:HTTP-NOT-FOUND,
'InvalidJson': $contacts:HTTP-CLIENT-FAIL,
'InvalidModel': $contacts:HTTP-CLIENT-FAIL,
'MissingProperty': $contacts:HTTP-CLIENT-FAIL,
'*': $contacts:HTTP-CLIENT-FAIL
};

(: map server side exception to http code :)
declare variable $contacts:SERVER-EXCEPTION-MAP := map
{
'DatabaseFail' := $contacts:HTTP-SERVER-FAIL,
'*' := $contacts:HTTP-SERVER-FAIL
'DatabaseFail': $contacts:HTTP-SERVER-FAIL,
'*': $contacts:HTTP-SERVER-FAIL
};


Expand Down Expand Up @@ -132,8 +132,8 @@ declare %private function contacts:skip-take-range($skip as xs:integer, $take as
{
map
{
'from' := $skip + 1,
'to' := $skip + $take
'from': $skip + 1,
'to': $skip + $take
}
};

Expand Down
2 changes: 1 addition & 1 deletion examples/templating/examples.xql
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function ex:hello-world($node as node(), $model as map(*), $language as xs:strin
declare
%templates:wrap
function ex:addresses($node as node(), $model as map(*)) as map(*) {
map { "addresses" := collection($config:app-root || "/data/addresses")/address }
map { "addresses": collection($config:app-root || "/data/addresses")/address }
};

declare
Expand Down
2 changes: 1 addition & 1 deletion examples/templating/restxq-demo.xql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function demo:page() {
let $content := doc("restxq-page.html")
let $config := map {
(: The following function will be called to look up template parameters :)
$templates:CONFIG_PARAM_RESOLVER := function($param as xs:string) as xs:string* {
$templates:CONFIG_PARAM_RESOLVER : function($param as xs:string) as xs:string* {
req:parameter($param)
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/web/guess-templates.xql
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ declare function guess:init($node as node(), $model as map(*)) as map(*){
else
guess:random(100)
return
map { "random" := $rand }
map { "random": $rand }
};

(:~
Expand Down
2 changes: 1 addition & 1 deletion modules/view.xql
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ declare option output:method "xhtml";
declare option output:media-type "text/html";

let $config := map {
$templates:CONFIG_APP_ROOT := $config:app-root
$templates:CONFIG_APP_ROOT : $config:app-root
}
let $lookup := function($functionName as xs:string, $arity as xs:int) {
try {
Expand Down

0 comments on commit dddfd3c

Please sign in to comment.