pub struct Routine {
pub routine_type: RoutineType,
pub arguments: Option<Vec<Argument>>,
pub return_type: Option<StandardSqlDataType>,
pub language: Option<Language>,
pub definition_body: String,
pub creation_time: Option<i64>,
pub determinism_level: Option<DeterminismLevel>,
pub description: Option<String>,
pub imported_libraries: Option<Vec<String>>,
pub etag: Option<String>,
pub routine_reference: RoutineReference,
pub last_modified_time: Option<i64>,
}
Fields
routine_type: RoutineType
Required. The type of routine.
arguments: Option<Vec<Argument>>
Optional.
return_type: Option<StandardSqlDataType>
Optional if language = “SQL”; required otherwise. If absent, the return type is inferred from definition_body at query time in each query that references this routine. If present, then the evaluated result will be cast to the specified returned type at query time. For example, for the functions created with the following statements: * CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);
* CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));
* CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));
The return_type is {type_kind: "FLOAT64"}
for Add
and Decrement
, and is absent for Increment
(inferred as FLOAT64 at query time). Suppose the function Add
is replaced by CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);
Then the inferred return type of Increment
is automatically changed to INT64 at query time, while the return type of Decrement
remains FLOAT64.
language: Option<Language>
Optional. Defaults to “SQL”.
definition_body: String
Required. The body of the routine. For functions, this is the expression in the AS clause. If language=SQL, it is the substring inside (but excluding) the parentheses. For example, for the function created with the following statement: CREATE FUNCTION JoinLines(x string, y string) as (concat(x, "\n", y))
The definition_body is concat(x, "\n", y)
(\n is not replaced with linebreak). If language=JAVASCRIPT, it is the evaluated string in the AS clause. For example, for the function created with the following statement: CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'
The definition_body is return "\n";\n
Note that both \n are replaced with linebreaks.
creation_time: Option<i64>
Output only. The time when this routine was created, in milliseconds since the epoch.
determinism_level: Option<DeterminismLevel>
Optional. [Experimental] The determinism level of the JavaScript UDF if defined.
description: Option<String>
Optional. [Experimental] The description of the routine if defined.
imported_libraries: Option<Vec<String>>
Optional. If language = “JAVASCRIPT”, this field stores the path of the imported JAVASCRIPT libraries.
etag: Option<String>
Output only. A hash of this resource.
routine_reference: RoutineReference
Required. Reference describing the ID of this routine.
last_modified_time: Option<i64>
Output only. The time when this routine was last modified, in milliseconds since the epoch.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Routine
impl<'de> Deserialize<'de> for Routine
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Routine
impl Send for Routine
impl Sync for Routine
impl Unpin for Routine
impl UnwindSafe for Routine
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more