Class: Google::Cloud::Bigquery::InsertResponse
- Inherits:
-
Object
- Object
- Google::Cloud::Bigquery::InsertResponse
- Defined in:
- lib/google/cloud/bigquery/insert_response.rb
Overview
InsertResponse
Defined Under Namespace
Classes: InsertError
Instance Method Summary collapse
- #error_count ⇒ Object
- #error_rows ⇒ Object
- #errors_for(row) ⇒ Object
- #insert_count ⇒ Object
- #insert_errors ⇒ Object
- #success? ⇒ Boolean
Instance Method Details
#error_count ⇒ Object
38 39 40 |
# File 'lib/google/cloud/bigquery/insert_response.rb', line 38 def error_count Array(@gapi.insert_errors).count end |
#error_rows ⇒ Object
50 51 52 53 54 |
# File 'lib/google/cloud/bigquery/insert_response.rb', line 50 def error_rows Array(@gapi.insert_errors).map do |ie| @rows[ie.index] end end |
#errors_for(row) ⇒ Object
56 57 58 59 60 |
# File 'lib/google/cloud/bigquery/insert_response.rb', line 56 def errors_for row ie = insert_errors.detect { |e| e.row == row } return ie.errors if ie [] end |
#insert_count ⇒ Object
34 35 36 |
# File 'lib/google/cloud/bigquery/insert_response.rb', line 34 def insert_count @rows.count - error_count end |
#insert_errors ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/google/cloud/bigquery/insert_response.rb', line 42 def insert_errors Array(@gapi.insert_errors).map do |ie| row = @rows[ie.index] errors = ie.errors.map { |e| JSON.parse e.to_json } InsertError.new row, errors end end |
#success? ⇒ Boolean
30 31 32 |
# File 'lib/google/cloud/bigquery/insert_response.rb', line 30 def success? error_count.zero? end |