Class: Google::Cloud::Bigquery::Argument
- Inherits:
-
Object
- Object
- Google::Cloud::Bigquery::Argument
- Defined in:
- lib/google/cloud/bigquery/argument.rb
Overview
Argument
Input/output argument of a function or a stored procedure. See Routine.
Instance Method Summary collapse
-
#any_type? ⇒ Boolean
Checks if the value of #argument_kind is
ANY_TYPE
. -
#argument_kind ⇒ String
The kind of argument.
-
#data_type ⇒ StandardSql::DataType
The data type of the argument.
-
#fixed_type? ⇒ Boolean
Checks if the value of #argument_kind is
FIXED_TYPE
. -
#in? ⇒ Boolean
Checks if the value of #mode is
IN
. -
#initialize(data_type, kind, mode, name) ⇒ Argument
constructor
Creates a new, immutable Argument object.
-
#inout? ⇒ Boolean
Checks if the value of #mode is
INOUT
. -
#mode ⇒ String
Specifies whether the argument is input or output.
-
#name ⇒ String
The name of the argument.
-
#out? ⇒ Boolean
Checks if the value of #mode is
OUT
.
Constructor Details
#initialize(data_type, kind, mode, name) ⇒ Argument
Creates a new, immutable Argument object.
83 84 85 86 |
# File 'lib/google/cloud/bigquery/argument.rb', line 83 def initialize **kwargs kwargs[:data_type] = StandardSql::DataType.gapi_from_string_or_data_type kwargs[:data_type] @gapi = Google::Apis::BigqueryV2::Argument.new(**kwargs) end |
Instance Method Details
#any_type? ⇒ Boolean
Checks if the value of #argument_kind is ANY_TYPE
. The default is false
.
127 128 129 |
# File 'lib/google/cloud/bigquery/argument.rb', line 127 def any_type? @gapi.argument_kind == "ANY_TYPE" end |
#argument_kind ⇒ String
The kind of argument. Optional. Defaults to FIXED_TYPE
.
FIXED_TYPE
- The argument is a variable with fully specified type, which can be a struct or an array, but not a table.ANY_TYPE
- The argument is any type, including struct or array, but not a table.
To be added: FIXED_TABLE
, ANY_TABLE
.
108 109 110 |
# File 'lib/google/cloud/bigquery/argument.rb', line 108 def argument_kind @gapi.argument_kind end |
#data_type ⇒ StandardSql::DataType
The data type of the argument. Required unless #argument_kind is ANY_TYPE
.
93 94 95 |
# File 'lib/google/cloud/bigquery/argument.rb', line 93 def data_type StandardSql::DataType.from_gapi @gapi.data_type end |
#fixed_type? ⇒ Boolean
Checks if the value of #argument_kind is FIXED_TYPE
. The default is true
.
117 118 119 120 |
# File 'lib/google/cloud/bigquery/argument.rb', line 117 def fixed_type? return true if @gapi.argument_kind.nil? @gapi.argument_kind == "FIXED_TYPE" end |
#in? ⇒ Boolean
Checks if the value of #mode is IN
. Can be set for procedures only. The default is false
.
149 150 151 |
# File 'lib/google/cloud/bigquery/argument.rb', line 149 def in? @gapi.mode == "IN" end |
#inout? ⇒ Boolean
Checks if the value of #mode is INOUT
. Can be set for procedures only. The default is false
.
167 168 169 |
# File 'lib/google/cloud/bigquery/argument.rb', line 167 def inout? @gapi.mode == "INOUT" end |
#mode ⇒ String
Specifies whether the argument is input or output. Optional. Can be set for procedures only.
- IN - The argument is input-only.
- OUT - The argument is output-only.
- INOUT - The argument is both an input and an output.
140 141 142 |
# File 'lib/google/cloud/bigquery/argument.rb', line 140 def mode @gapi.mode end |
#name ⇒ String
The name of the argument. Optional. Can be absent for a function return argument.
177 178 179 |
# File 'lib/google/cloud/bigquery/argument.rb', line 177 def name @gapi.name end |
#out? ⇒ Boolean
Checks if the value of #mode is OUT
. Can be set for procedures only. The default is false
.
158 159 160 |
# File 'lib/google/cloud/bigquery/argument.rb', line 158 def out? @gapi.mode == "OUT" end |