You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/tools/pages/udfs-ui.adoc
+24-15Lines changed: 24 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,19 +5,24 @@
5
5
[abstract]
6
6
{description}
7
7
8
-
Starting from Couchbase Server 7.1, the Couchbase Administration console provides an interface to create, update, or delete user-defined functions written in {sqlpp} or JavaScript.
8
+
Couchbase Administration console provides an interface to create, update, or delete user-defined functions written in {sqlpp} or JavaScript.
9
9
10
-
Start at the administration console and select menu:Query[UDFs] from the menus to access the *UDF* screen.
10
+
Start at the administration console and select menu:Query[UDF] from the menus to access the *UDF* screen.
11
11
12
12
image::udf-screen.png[alt="screen for adding user-defined functions"]
13
13
14
-
== Javascript Function Libraries
14
+
If you have created any external libraries to store external function code, these are listed in the *JavaScript Function Libraries* section.
15
+
16
+
If you have created any inline or external user-defined functions, these are listed in the *User-Defined Functions* section.
17
+
This includes {sqlpp} managed user-defined functions -- that is, JavaScript functions which are not stored in a library.
18
+
19
+
== JavaScript Function Libraries
15
20
16
21
Click on the `{plus}{nbsp}add function library` link to create a library of JavaScript functions.
When you create a new library, an example function (`add`) is supplied as an example.
25
+
When you create a new library, an example function (`add`) is supplied as an example.
21
26
You can delete it when you add your own function, or leave it to serve as a basic example.
22
27
23
28
You can set a *Namespace* for your library which will restrict its access to users that have permissions to access the bucket and scope specified by the namespace.
@@ -28,7 +33,7 @@ Click btn:[Save] to save the library and return to the main UDF screen, or btn:[
28
33
29
34
image::udf-screen-with-library.png[alt="udf screen with library added"]
30
35
31
-
You can *edit* the library again to add and/or delete functions contained inside it.
36
+
You can *edit* the library again to add and/or delete functions contained inside it.
32
37
33
38
You can also delete the whole library by clicking on the *drop* link.
34
39
@@ -37,6 +42,11 @@ You can also delete the whole library by clicking on the *drop* link.
37
42
You can add your own user-defined functions in the lower *User-Defined Functions* list.
38
43
These functions can be one of two types:
39
44
45
+
[horizontal]
46
+
*Inline*:: This is a function written in {sqlpp} which can be used as part of another {sqlpp} statement, such as xref:n1ql:n1ql-language-reference/selectintro.adoc[SELECT] and xref:n1ql:n1ql-language-reference/execfunction.adoc[EXECUTE FUNCTION].
47
+
48
+
*JavaScript*:: You can create {sqlpp} functions that call the JavaScript functions defined in your library.
49
+
40
50
To add a user-defined function, click on *{plus}{nbsp}add function* below the *User-Defined Functions* list.
41
51
42
52
image::udf-add-function-inline.png[,500, alt="Add function screen"]
@@ -50,20 +60,19 @@ The name must be unique and is case-insensitive.
50
60
51
61
You can define a list of fixed parameters for your function, or you can use the `...` symbol which indicates a variable length function list defined as `args[]`.
52
62
53
-
The *Function Type* can be either `inline` or `Javascript`:
54
-
55
-
[horizontal]
56
-
*Inline*:: This is a function written in {sqlpp} which can be used as part of another {sqlpp} statement, such as xref:n1ql:n1ql-language-reference/selectintro.adoc[SELECT] and xref:n1ql:n1ql-language-reference/execfunction.adoc[EXECUTE FUNCTION].
57
-
58
-
*JavaScript*:: You can create {sqlpp} functions that call the Javascript functions defined in your library.
63
+
The *Function Type* can be either `inline` or `javascript`.
59
64
60
65
If you are defining an `inline` function then you can fill in any valid {sqlpp} expression which can then be used as part of another {sqlpp} statement.
61
66
This is the default when creating a function.
62
67
63
-
If you switch *Function Type* to `Javascript` then the dialog will change to configure a JavaScript function call.
68
+
If you switch *Function Type* to `javascript` then the dialog will change to configure a JavaScript function call.
Then you select the JavaScript Library where you created your JavaScript function, and the name of your function.
73
+
(There is no need to include the parameters.)
66
74
67
-
Then you select the `Javascript Library` where you created your Javascript function, and the name of your function. (There is no need to include the parameters.)
75
+
Once the details have been filled, you can click the btn:[Save Function] to save the function and exit the dialog, or click on btn:[Cancel] to exit the dialog without saving the details.
68
76
69
-
Once the details have been filled, you can click the btn:[Save Function] to save the function and exit the dialog, or click on btn:[Cancel] to exit the dialog without saving the details.
77
+
NOTE: You cannot use the UDF console to create {sqlpp} managed user-defined functions -- that is, JavaScript functions which are not stored in a library.
78
+
To do this, see xref:n1ql:n1ql-language-reference/createfunction.adoc[].
0 commit comments