Class: RbBigQuery::Schema
- Inherits:
-
Object
- Object
- RbBigQuery::Schema
- Defined in:
- lib/rbbigquery/schema.rb
Overview
Schema Builder
Instance Attribute Summary collapse
-
#schema ⇒ Object
Returns the value of attribute schema.
Class Method Summary collapse
-
.build(&blk) ⇒ Array<Hash>
Builds schema for BigQuery.
Instance Method Summary collapse
Instance Attribute Details
#schema ⇒ Object
Returns the value of attribute schema.
4 5 6 |
# File 'lib/rbbigquery/schema.rb', line 4 def schema @schema end |
Class Method Details
.build(&blk) ⇒ Array<Hash>
Builds schema for BigQuery
10 11 12 13 14 15 |
# File 'lib/rbbigquery/schema.rb', line 10 def build(&blk) instance = new instance.schema = [] instance.instance_eval &blk instance.schema end |
Instance Method Details
#integer(name) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/rbbigquery/schema.rb', line 25 def integer(name) self.schema.push({ type: 'INTEGER', name: name }) end |
#string(name) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/rbbigquery/schema.rb', line 18 def string(name) self.schema.push({ type: 'STRING', name: name }) end |