Class: Google::Cloud::Bigquery::Schema::Field
- Inherits:
-
Object
- Object
- Google::Cloud::Bigquery::Schema::Field
- Defined in:
- lib/google/cloud/bigquery/schema.rb
Instance Method Summary collapse
- #description ⇒ Object
- #description=(new_description) ⇒ Object
- #fields ⇒ Object
- #fields=(new_fields) ⇒ Object
-
#initialize(name, type, description: nil, mode: :nullable, fields: nil) ⇒ Field
constructor
A new instance of Field.
- #mode ⇒ Object
- #mode=(new_mode) ⇒ Object
- #name ⇒ Object
- #name=(new_name) ⇒ Object
- #type ⇒ Object
- #type=(new_type) ⇒ Object
Constructor Details
#initialize(name, type, description: nil, mode: :nullable, fields: nil) ⇒ Field
Returns a new instance of Field
247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/google/cloud/bigquery/schema.rb', line 247 def initialize name, type, description: nil, mode: :nullable, fields: nil @gapi = Google::Apis::BigqueryV2::TableFieldSchema.new @gapi.update! name: name @gapi.update! type: verify_type(type) @gapi.update! description: description if description @gapi.update! mode: verify_mode(mode) if mode if fields @fields = fields check_for_changed_fields! end @original_json = @gapi.to_json end |
Instance Method Details
#description ⇒ Object
277 278 279 |
# File 'lib/google/cloud/bigquery/schema.rb', line 277 def description @gapi.description end |
#description=(new_description) ⇒ Object
281 282 283 |
# File 'lib/google/cloud/bigquery/schema.rb', line 281 def description= new_description @gapi.update! description: new_description end |
#fields ⇒ Object
293 294 295 |
# File 'lib/google/cloud/bigquery/schema.rb', line 293 def fields @fields ||= Array(@gapi.fields).map { |f| Field.from_gapi f } end |
#fields=(new_fields) ⇒ Object
297 298 299 |
# File 'lib/google/cloud/bigquery/schema.rb', line 297 def fields= new_fields @fields = new_fields end |
#mode ⇒ Object
285 286 287 |
# File 'lib/google/cloud/bigquery/schema.rb', line 285 def mode @gapi.mode end |
#mode=(new_mode) ⇒ Object
289 290 291 |
# File 'lib/google/cloud/bigquery/schema.rb', line 289 def mode= new_mode @gapi.update! mode: verify_mode(new_mode) end |
#name ⇒ Object
261 262 263 |
# File 'lib/google/cloud/bigquery/schema.rb', line 261 def name @gapi.name end |
#name=(new_name) ⇒ Object
265 266 267 |
# File 'lib/google/cloud/bigquery/schema.rb', line 265 def name= new_name @gapi.update! name: new_name end |
#type ⇒ Object
269 270 271 |
# File 'lib/google/cloud/bigquery/schema.rb', line 269 def type @gapi.type end |
#type=(new_type) ⇒ Object
273 274 275 |
# File 'lib/google/cloud/bigquery/schema.rb', line 273 def type= new_type @gapi.update! type: verify_type(new_type) end |