aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/goccy/go-json/internal/decoder/invalid.go
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2024-06-24 14:30:25 +0200
committerTaras Madan <tarasmadan@google.com>2024-07-05 07:51:41 +0000
commit5145b76b8a41b71a7b3c06373959c12f3a22014b (patch)
treed87c1ca1d0979767cc07ace6c0a616ec311a8fc6 /vendor/github.com/goccy/go-json/internal/decoder/invalid.go
parent7d7fe8807550c6e02def380d335ae0230f1e495c (diff)
vendor: add bigquery client library
Diffstat (limited to 'vendor/github.com/goccy/go-json/internal/decoder/invalid.go')
-rw-r--r--vendor/github.com/goccy/go-json/internal/decoder/invalid.go55
1 files changed, 55 insertions, 0 deletions
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/invalid.go b/vendor/github.com/goccy/go-json/internal/decoder/invalid.go
new file mode 100644
index 000000000..4c9721b09
--- /dev/null
+++ b/vendor/github.com/goccy/go-json/internal/decoder/invalid.go
@@ -0,0 +1,55 @@
+package decoder
+
+import (
+ "reflect"
+ "unsafe"
+
+ "github.com/goccy/go-json/internal/errors"
+ "github.com/goccy/go-json/internal/runtime"
+)
+
+type invalidDecoder struct {
+ typ *runtime.Type
+ kind reflect.Kind
+ structName string
+ fieldName string
+}
+
+func newInvalidDecoder(typ *runtime.Type, structName, fieldName string) *invalidDecoder {
+ return &invalidDecoder{
+ typ: typ,
+ kind: typ.Kind(),
+ structName: structName,
+ fieldName: fieldName,
+ }
+}
+
+func (d *invalidDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
+ return &errors.UnmarshalTypeError{
+ Value: "object",
+ Type: runtime.RType2Type(d.typ),
+ Offset: s.totalOffset(),
+ Struct: d.structName,
+ Field: d.fieldName,
+ }
+}
+
+func (d *invalidDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
+ return 0, &errors.UnmarshalTypeError{
+ Value: "object",
+ Type: runtime.RType2Type(d.typ),
+ Offset: cursor,
+ Struct: d.structName,
+ Field: d.fieldName,
+ }
+}
+
+func (d *invalidDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
+ return nil, 0, &errors.UnmarshalTypeError{
+ Value: "object",
+ Type: runtime.RType2Type(d.typ),
+ Offset: cursor,
+ Struct: d.structName,
+ Field: d.fieldName,
+ }
+}