Google Cloud BigQuery Analytics Hub V1 Client - Class JavaScriptUDF (1.2.1)
Stay organized with collections
Save and categorize content based on your preferences.
Reference documentation and code samples for the Google Cloud BigQuery Analytics Hub V1 Client class JavaScriptUDF.
User-defined JavaScript function that can transform or filter a Pub/Sub
message.
Generated from protobuf message google.cloud.bigquery.analyticshub.v1.JavaScriptUDF
Namespace
Google \ Cloud \ BigQuery \ AnalyticsHub \ V1
Methods
__construct
Parameters |
Name |
Description |
data |
array
Optional. Data for populating the Message object.
|
↳ function_name |
string
Required. Name of the JavasScript function that should applied to Pub/Sub messages.
|
↳ code |
string
Required. JavaScript code that contains a function function_name with the below signature: /** * * Transforms a Pub/Sub message. * * @return {(Object<string, (string | Object<string, string>)>|null)} - To * * filter a message, return `null`. To transform a message return a map * * with the following keys: * * - (required) 'data' : {string} * * - (optional) 'attributes' : {Object<string, string>} * * Returning empty `attributes` will remove all attributes from the * * message. * * * @param {(Object<string, (string | Object<string, string>)>} Pub/Sub * * message. Keys: * * - (required) 'data' : {string} * * - (required) 'attributes' : {Object<string, string>} * * * @param {Object<string, any>} metadata - Pub/Sub message metadata. * * Keys: * * - (required) 'message_id' : {string} * * - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format * * - (optional) 'ordering_key': {string} */ function <function_name>(message, metadata) { }
|
getFunctionName
Required. Name of the JavasScript function that should applied to Pub/Sub
messages.
Returns |
Type |
Description |
string |
|
setFunctionName
Required. Name of the JavasScript function that should applied to Pub/Sub
messages.
Parameter |
Name |
Description |
var |
string
|
Returns |
Type |
Description |
$this |
|
getCode
Required. JavaScript code that contains a function function_name
with the
below signature:
/**
* Transforms a Pub/Sub message.
* @return {(Object<string, (string | Object<string, string>)>|null)} - To
* filter a message, return `null`. To transform a message return a map
* with the following keys:
* - (required) 'data' : {string}
* - (optional) 'attributes' : {Object<string, string>}
* Returning empty `attributes` will remove all attributes from the
* message.
*
* @param {(Object<string, (string | Object<string, string>)>} Pub/Sub
* message. Keys:
* - (required) 'data' : {string}
* - (required) 'attributes' : {Object<string, string>}
*
* @param {Object<string, any>} metadata - Pub/Sub message metadata.
* Keys:
* - (required) 'message_id' : {string}
* - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
* - (optional) 'ordering_key': {string}
*/
function <function_name>(message, metadata) {
}
Returns |
Type |
Description |
string |
|
setCode
Required. JavaScript code that contains a function function_name
with the
below signature:
/**
* Transforms a Pub/Sub message.
* @return {(Object<string, (string | Object<string, string>)>|null)} - To
* filter a message, return `null`. To transform a message return a map
* with the following keys:
* - (required) 'data' : {string}
* - (optional) 'attributes' : {Object<string, string>}
* Returning empty `attributes` will remove all attributes from the
* message.
*
* @param {(Object<string, (string | Object<string, string>)>} Pub/Sub
* message. Keys:
* - (required) 'data' : {string}
* - (required) 'attributes' : {Object<string, string>}
*
* @param {Object<string, any>} metadata - Pub/Sub message metadata.
* Keys:
* - (required) 'message_id' : {string}
* - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
* - (optional) 'ordering_key': {string}
*/
function <function_name>(message, metadata) {
}
Parameter |
Name |
Description |
var |
string
|
Returns |
Type |
Description |
$this |
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[],null,["# Google Cloud BigQuery Analytics Hub V1 Client - Class JavaScriptUDF (1.2.1)\n\nVersion latestkeyboard_arrow_down\n\n- [1.2.1 (latest)](/php/docs/reference/cloud-bigquery-analyticshub/latest/V1.JavaScriptUDF)\n- [1.2.0](/php/docs/reference/cloud-bigquery-analyticshub/1.2.0/V1.JavaScriptUDF)\n- [1.1.0](/php/docs/reference/cloud-bigquery-analyticshub/1.1.0/V1.JavaScriptUDF)\n- [1.0.4](/php/docs/reference/cloud-bigquery-analyticshub/1.0.4/V1.JavaScriptUDF)\n- [0.5.3](/php/docs/reference/cloud-bigquery-analyticshub/0.5.3/V1.JavaScriptUDF)\n- [0.4.0](/php/docs/reference/cloud-bigquery-analyticshub/0.4.0/V1.JavaScriptUDF)\n- [0.3.2](/php/docs/reference/cloud-bigquery-analyticshub/0.3.2/V1.JavaScriptUDF)\n- [0.2.2](/php/docs/reference/cloud-bigquery-analyticshub/0.2.2/V1.JavaScriptUDF)\n- [0.1.6](/php/docs/reference/cloud-bigquery-analyticshub/0.1.6/V1.JavaScriptUDF) \nReference documentation and code samples for the Google Cloud BigQuery Analytics Hub V1 Client class JavaScriptUDF.\n\nUser-defined JavaScript function that can transform or filter a Pub/Sub\nmessage.\n\nGenerated from protobuf message `google.cloud.bigquery.analyticshub.v1.JavaScriptUDF`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ BigQuery \\\\ AnalyticsHub \\\\ V1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getFunctionName\n\nRequired. Name of the JavasScript function that should applied to Pub/Sub\nmessages.\n\n### setFunctionName\n\nRequired. Name of the JavasScript function that should applied to Pub/Sub\nmessages.\n\n### getCode\n\nRequired. JavaScript code that contains a function `function_name` with the\nbelow signature: \n\n /**\n * Transforms a Pub/Sub message.\n\n * @return {(Object\u003cstring, (string | Object\u003cstring, string\u003e)\u003e|null)} - To\n * filter a message, return `null`. To transform a message return a map\n * with the following keys:\n * - (required) 'data' : {string}\n * - (optional) 'attributes' : {Object\u003cstring, string\u003e}\n * Returning empty `attributes` will remove all attributes from the\n * message.\n *\n * @param {(Object\u003cstring, (string | Object\u003cstring, string\u003e)\u003e} Pub/Sub\n * message. Keys:\n * - (required) 'data' : {string}\n * - (required) 'attributes' : {Object\u003cstring, string\u003e}\n *\n * @param {Object\u003cstring, any\u003e} metadata - Pub/Sub message metadata.\n * Keys:\n * - (required) 'message_id' : {string}\n * - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format\n * - (optional) 'ordering_key': {string}\n */\n function \u003cfunction_name\u003e(message, metadata) {\n }\n\n### setCode\n\nRequired. JavaScript code that contains a function `function_name` with the\nbelow signature: \n\n /**\n * Transforms a Pub/Sub message.\n\n * @return {(Object\u003cstring, (string | Object\u003cstring, string\u003e)\u003e|null)} - To\n * filter a message, return `null`. To transform a message return a map\n * with the following keys:\n * - (required) 'data' : {string}\n * - (optional) 'attributes' : {Object\u003cstring, string\u003e}\n * Returning empty `attributes` will remove all attributes from the\n * message.\n *\n * @param {(Object\u003cstring, (string | Object\u003cstring, string\u003e)\u003e} Pub/Sub\n * message. Keys:\n * - (required) 'data' : {string}\n * - (required) 'attributes' : {Object\u003cstring, string\u003e}\n *\n * @param {Object\u003cstring, any\u003e} metadata - Pub/Sub message metadata.\n * Keys:\n * - (required) 'message_id' : {string}\n * - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format\n * - (optional) 'ordering_key': {string}\n */\n function \u003cfunction_name\u003e(message, metadata) {\n }"]]