Class: Google::Cloud::Bigquery::StandardSql::Field
- Inherits:
-
Object
- Object
- Google::Cloud::Bigquery::StandardSql::Field
- Defined in:
- lib/google/cloud/bigquery/standard_sql.rb
Overview
Instance Method Summary collapse
-
#initialize(name, type) ⇒ Field
constructor
Creates a new, immutable StandardSql::Field object.
-
#name ⇒ String?
The name of the field.
-
#type ⇒ DataType?
The type of the field.
Constructor Details
#initialize(name, type) ⇒ Field
Creates a new, immutable StandardSql::Field object.
107 108 109 110 111 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 107 def initialize **kwargs # Convert client object kwargs to a gapi object kwargs[:type] = DataType.gapi_from_string_or_data_type kwargs[:type] if kwargs[:type] @gapi = Google::Apis::BigqueryV2::StandardSqlField.new(**kwargs) end |
Instance Method Details
#name ⇒ String?
The name of the field. Optional. Can be absent for struct fields.
118 119 120 121 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 118 def name return if @gapi.name == "".freeze @gapi.name end |
#type ⇒ DataType?
The type of the field. Optional. Absent if not explicitly specified (e.g., CREATE FUNCTION
statement can
omit the return type; in this case the output parameter does not have this "type" field).
129 130 131 |
# File 'lib/google/cloud/bigquery/standard_sql.rb', line 129 def type DataType.from_gapi @gapi.type if @gapi.type end |