Skip to content

Commit d438c4e

Browse files
Adds an easyjson marshaler and unmarshaler for execResponseRowType.
This struct has a member with an unexported data type (fieldMetadata). Without the explicit marshaler/unmarshaler, we cannot use easyjson outside of this mod. Failings unit tests Both upstream and origin - TestArrowBatchHighPrecision - TestLongRunningAsyncQueryFetchResultByID - TestBindingBulkArray - TestMaxLobSize - TestUrlDecodeIfNeededE2E Only origin: - TestBulkArrayBinding
1 parent 900d3f4 commit d438c4e

File tree

4 files changed

+392
-349
lines changed

4 files changed

+392
-349
lines changed

export.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,24 @@ func (sr *snowflakeResult) SetExecResponse(er *ExecResponse) {
5656
}
5757

5858
// StringToValue exports stringToValue
59-
func StringToValue(ctx context.Context, dest *driver.Value, srcColumnMeta execResponseRowType, srcValue *string, loc *time.Location, params map[string]*string) error {
60-
return stringToValue(context.Background(), dest, srcColumnMeta, srcValue, loc, params)
59+
// Deprecated: please use StringToValueWithContext instead
60+
func StringToValue(dest *driver.Value, srcColumnMeta execResponseRowType, srcValue *string, loc *time.Location) error {
61+
return stringToValue(context.Background(), dest, srcColumnMeta, srcValue, loc, map[string]*string{})
62+
}
63+
64+
// StringToValueWithContext exports stringToValue
65+
func StringToValueWithContext(ctx context.Context, dest *driver.Value, srcColumnMeta execResponseRowType, srcValue *string, loc *time.Location, params map[string]*string) error {
66+
return stringToValue(ctx, dest, srcColumnMeta, srcValue, loc, params)
67+
}
68+
69+
// ExecResponseRowTypeEquals exports execResponseRowTypeEquals
70+
func ExecResponseRowTypeEquals(a, b ExecResponseRowType) bool {
71+
// Skip fieldMetadata
72+
return a.Name == b.Name &&
73+
a.ByteLength == b.ByteLength &&
74+
a.Length == b.Length &&
75+
a.Type == b.Type &&
76+
a.Precision == b.Precision &&
77+
a.Scale == b.Scale &&
78+
a.Nullable == b.Nullable
6179
}

query.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ type contextData struct {
4848
Base64Data string `json:"base64Data,omitempty"`
4949
}
5050

51+
//easyjson:json
5152
type execResponseRowType struct {
5253
Name string `json:"name"`
5354
Fields []fieldMetadata `json:"fields"`

0 commit comments

Comments
 (0)