这是indexloc提供的服务,不要输入任何密码
Skip to content

bigquery: Logging field name on error in null value setting to struct field #2612

@ysktir

Description

@ysktir

Is your feature request related to a problem? Please describe.
An error occurs when the null value of bigquery set to the primitive type field of struct of go, and the following log appears.

var errNoNulls = errors.New("bigquery: NULL values cannot be read into structs")

this error log is abstract and it is difficult to debug.Especially when the number of fields in the struct is large, it takes time to find the offending field.

Describe the solution you'd like
Specifically output to the log which field name(or tag name) the error occurred in mapping.

For example, the following log.
NULL Value cannot assignable to struct field any_field_name of type int.

Describe alternatives you've considered
Add logs to the following parts of the module

err = op.setFunc(field, values[op.valueIndex])

log.Printf("set value to %s", vstruct.Type().FieldByIndex(op.fieldIndex).Name)
err = op.setFunc(field, values[op.valueIndex])

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the BigQuery API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions