[][src]Struct google_bigquery2::Routine

pub struct Routine {
    pub routine_type: Option<String>,
    pub language: Option<String>,
    pub creation_time: Option<String>,
    pub imported_libraries: Option<Vec<String>>,
    pub routine_reference: Option<RoutineReference>,
    pub etag: Option<String>,
    pub arguments: Option<Vec<Argument>>,
    pub return_type: Option<StandardSqlDataType>,
    pub last_modified_time: Option<String>,
    pub definition_body: Option<String>,
}

A user-defined function or a stored procedure.

Activities

This type is used in activities, which are methods you may call on this type or where this type is involved in. The list links the activity name, along with information about where it is used (one of request and response).

Fields

routine_type: Option<String>

Required.

language: Option<String>

Optional. Defaults to "SQL".

creation_time: Option<String>

Output only. The time when this routine was created, in milliseconds since the epoch.

imported_libraries: Option<Vec<String>>

Optional. If language = "JAVASCRIPT", this field stores the path of the imported JAVASCRIPT libraries.

routine_reference: Option<RoutineReference>

Required. Reference describing the ID of this routine.

etag: Option<String>

Output only. A hash of this resource.

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.

last_modified_time: Option<String>

Output only. The time when this routine was last modified, in milliseconds since the epoch.

definition_body: Option<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.

Trait Implementations

impl Resource for Routine[src]

impl ResponseResult for Routine[src]

impl RequestValue for Routine[src]

impl Default for Routine[src]

impl Clone for Routine[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Routine[src]

impl Serialize for Routine[src]

impl<'de> Deserialize<'de> for Routine[src]

Auto Trait Implementations

impl Send for Routine

impl Unpin for Routine

impl Sync for Routine

impl UnwindSafe for Routine

impl RefUnwindSafe for Routine

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]