dba/users
library moduleUR
Summary
Drop patterns.
- Tags
Author: Christian Grün, BaseX Team 2005-21, BSD License
__source : users/pattern-drop.xqm
Imports
This module is imported by 0 modules. It imports 1 modules.
Variables
Functions
4.1 dba:pattern-drop
Arities: dba:pattern-drop#2UR
dba:pattern-drop
(
$name
as
xs:string
, $patterns
as
xs:string*
)
as
empty-sequence()
- name
as
xs:string
user name - patterns
as
xs:string*
database patterns
empty-sequence()
redirection
Invokes 3 functions from 2 modules
- util:info#3
- util:redirect#2
- {http://basex.org/modules/user}drop#2
Invoked by 0 functions from 0 modules
Annotations
%updating | () |
%rest:GET | () |
%rest:path | ('/dba/pattern-drop') |
%rest:query-param | ('name','{$name}') |
%rest:query-param | ('pattern','{$patterns}') |
Source ( 12 lines)
function dba:pattern-drop(
$name as xs:string,
$patterns as xs:string*
) as empty-sequence() {
try {
$patterns ! user:drop($name, .),
util:redirect($dba:SUB, map {
'name': $name, 'info': util:info($patterns, 'pattern', 'dropped') })
} catch * {
util:redirect($dba:SUB, map { 'error': $err:description })
}
}
Namespaces
The following namespaces are defined:
Prefix | Uri |
---|---|
ann | http://www.w3.org/2012/xquery |
dba | dba/users 2 3 4 5 6 7 |
rest | http://exquery.org/ns/restxq |
util | dba/util |
Source Code
(:~
: Drop patterns.
:
: @author Christian Grün, BaseX Team 2005-21, BSD License
:)
module namespace dba = 'dba/users';
import module namespace util = 'dba/util' at '../lib/util.xqm';
(:~ Top category :)
declare variable $dba:SUB := 'user';
(:~
: Drops a pattern.
: @param $name user name
: @param $patterns database patterns
: @return redirection
:)
declare
%updating
%rest:GET
%rest:path('/dba/pattern-drop')
%rest:query-param('name', '{$name}')
%rest:query-param('pattern', '{$patterns}')
function dba:pattern-drop(
$name as xs:string,
$patterns as xs:string*
) as empty-sequence() {
try {
$patterns ! user:drop($name, .),
util:redirect($dba:SUB, map {
'name': $name, 'info': util:info($patterns, 'pattern', 'dropped') })
} catch * {
util:redirect($dba:SUB, map { 'error': $err:description })
}
};