Class: Google::Cloud::Bigquery::StandardSql::DataType
- Inherits:
-
Object
- Object
- Google::Cloud::Bigquery::StandardSql::DataType
- Defined in:
- lib/google/cloud/bigquery/standard_sql.rb
Overview
Helpers collapse
-
#array? ⇒ Boolean
Checks if the #type_kind of the field is
ARRAY
. -
#bignumeric? ⇒ Boolean
Checks if the #type_kind of the field is
BIGNUMERIC
. -
#boolean? ⇒ Boolean
Checks if the #type_kind of the field is
BOOL
. -
#bytes? ⇒ Boolean
Checks if the #type_kind of the field is
BYTES
. -
#date? ⇒ Boolean
Checks if the #type_kind of the field is
DATE
. -
#datetime? ⇒ Boolean
Checks if the #type_kind of the field is
DATETIME
. -
#float? ⇒ Boolean
Checks if the #type_kind of the field is
FLOAT64
. -
#geography? ⇒ Boolean
Checks if the #type_kind of the field is
GEOGRAPHY
. -
#int? ⇒ Boolean
Checks if the #type_kind of the field is
INT64
. -
#numeric? ⇒ Boolean
Checks if the #type_kind of the field is
NUMERIC
. -
#string? ⇒ Boolean
Checks if the #type_kind of the field is
STRING
. -
#struct? ⇒ Boolean
Checks if the #type_kind of the field is
STRUCT
. -
#time? ⇒ Boolean
Checks if the #type_kind of the field is
TIME
. -
#timestamp? ⇒ Boolean
Checks if the #type_kind of the field is
TIMESTAMP
.
Instance Method Summary collapse
-
#array_element_type ⇒ DataType?
The type of the array's elements, if #type_kind is
ARRAY
. -
#initialize(type_kind, array_element_type, struct_type) ⇒ DataType
constructor
Creates a new, immutable StandardSql::DataType object.
-
#struct_type ⇒ StructType?
The fields of the struct, in order, if #type_kind is
STRUCT
. -
#type_kind ⇒ String
The top level type of this field.
Constructor Details
#initialize(type_kind, array_element_type, struct_type) ⇒ DataType
Creates a new, immutable StandardSql::DataType object.
201 202 203 204 205 206 207 208 209 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 201 def initialize **kwargs # Convert client object kwargs to a gapi object if kwargs[:array_element_type] kwargs[:array_element_type] = self.class.gapi_from_string_or_data_type kwargs[:array_element_type] end kwargs[:struct_type] = kwargs[:struct_type].to_gapi if kwargs[:struct_type] @gapi = Google::Apis::BigqueryV2::StandardSqlDataType.new(**kwargs) end |
Instance Method Details
#array? ⇒ Boolean
Checks if the #type_kind of the field is ARRAY
.
382 383 384 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 382 def array? type_kind == "ARRAY".freeze end |
#array_element_type ⇒ DataType?
The type of the array's elements, if #type_kind is ARRAY
. See #array?. Optional.
228 229 230 231 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 228 def array_element_type return if @gapi.array_element_type.nil? DataType.from_gapi @gapi.array_element_type end |
#bignumeric? ⇒ Boolean
Checks if the #type_kind of the field is BIGNUMERIC
.
283 284 285 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 283 def bignumeric? type_kind == "BIGNUMERIC".freeze end |
#boolean? ⇒ Boolean
Checks if the #type_kind of the field is BOOL
.
294 295 296 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 294 def boolean? type_kind == "BOOL".freeze end |
#bytes? ⇒ Boolean
Checks if the #type_kind of the field is BYTES
.
316 317 318 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 316 def bytes? type_kind == "BYTES".freeze end |
#date? ⇒ Boolean
Checks if the #type_kind of the field is DATE
.
327 328 329 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 327 def date? type_kind == "DATE".freeze end |
#datetime? ⇒ Boolean
Checks if the #type_kind of the field is DATETIME
.
338 339 340 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 338 def datetime? type_kind == "DATETIME".freeze end |
#float? ⇒ Boolean
Checks if the #type_kind of the field is FLOAT64
.
261 262 263 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 261 def float? type_kind == "FLOAT64".freeze end |
#geography? ⇒ Boolean
Checks if the #type_kind of the field is GEOGRAPHY
.
349 350 351 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 349 def geography? type_kind == "GEOGRAPHY".freeze end |
#int? ⇒ Boolean
Checks if the #type_kind of the field is INT64
.
250 251 252 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 250 def int? type_kind == "INT64".freeze end |
#numeric? ⇒ Boolean
Checks if the #type_kind of the field is NUMERIC
.
272 273 274 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 272 def numeric? type_kind == "NUMERIC".freeze end |
#string? ⇒ Boolean
Checks if the #type_kind of the field is STRING
.
305 306 307 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 305 def string? type_kind == "STRING".freeze end |
#struct? ⇒ Boolean
Checks if the #type_kind of the field is STRUCT
.
393 394 395 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 393 def struct? type_kind == "STRUCT".freeze end |
#struct_type ⇒ StructType?
The fields of the struct, in order, if #type_kind is STRUCT
. See #struct?. Optional.
238 239 240 241 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 238 def struct_type return if @gapi.struct_type.nil? StructType.from_gapi @gapi.struct_type end |
#time? ⇒ Boolean
Checks if the #type_kind of the field is TIME
.
360 361 362 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 360 def time? type_kind == "TIME".freeze end |
#timestamp? ⇒ Boolean
Checks if the #type_kind of the field is TIMESTAMP
.
371 372 373 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 371 def type_kind == "TIMESTAMP".freeze end |
#type_kind ⇒ String
The top level type of this field. Required. Can be any standard SQL data type (e.g., INT64
, DATE
,
ARRAY
).
219 220 221 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 219 def type_kind @gapi.type_kind end |