Skip to content

Commit bea4028

Browse files
authored
docs(bigquery): add numeric and bignumeric to RowIterator docs (#6560)
Document field type conversions for `NUMERIC` and `BIGNUMERIC` types when using the `RowIterator` for reading data from BigQuery. Solves issue #6492
1 parent e8955d9 commit bea4028

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

‎bigquery/integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ func TestIntegration_InsertAndReadNullable(t *testing.T) {
11901190
ctm := civil.Time{Hour: 15, Minute: 4, Second: 5, Nanosecond: 6000}
11911191
cdt := civil.DateTime{Date: testDate, Time: ctm}
11921192
rat := big.NewRat(33, 100)
1193-
rat2 := big.NewRat(66, 100)
1193+
rat2 := big.NewRat(66, 10e10)
11941194
geo := "POINT(-122.198939 47.669865)"
11951195

11961196
// Nil fields in the struct.

‎bigquery/iterator.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ type pageFetcher func(ctx context.Context, _ *rowSource, _ Schema, startIndex ui
114114
// DATE civil.Date
115115
// TIME civil.Time
116116
// DATETIME civil.DateTime
117+
// NUMERIC *big.Rat
118+
// BIGNUMERIC *big.Rat
119+
//
120+
// The big.Rat type supports numbers of arbitrary size and precision.
121+
// See https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#numeric-type
122+
// for more on NUMERIC.
117123
//
118124
// A repeated field corresponds to a slice or array of the element type. A STRUCT
119125
// type (RECORD or nested schema) corresponds to a nested struct or struct pointer.

0 commit comments

Comments
 (0)