From 6949d6c543e9397578c7c840812df9bbf8531528 Mon Sep 17 00:00:00 2001 From: Amine Hilaly Date: Wed, 15 May 2019 15:04:57 +0200 Subject: Upgrade gqlgen version to v0.9.0 --- .../github.com/99designs/gqlgen/graphql/upload.go | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 vendor/github.com/99designs/gqlgen/graphql/upload.go (limited to 'vendor/github.com/99designs/gqlgen/graphql/upload.go') diff --git a/vendor/github.com/99designs/gqlgen/graphql/upload.go b/vendor/github.com/99designs/gqlgen/graphql/upload.go new file mode 100644 index 00000000..22d61031 --- /dev/null +++ b/vendor/github.com/99designs/gqlgen/graphql/upload.go @@ -0,0 +1,26 @@ +package graphql + +import ( + "fmt" + "io" +) + +type Upload struct { + File io.Reader + Filename string + Size int64 +} + +func MarshalUpload(f Upload) Marshaler { + return WriterFunc(func(w io.Writer) { + io.Copy(w, f.File) + }) +} + +func UnmarshalUpload(v interface{}) (Upload, error) { + upload, ok := v.(Upload) + if !ok { + return Upload{}, fmt.Errorf("%T is not an Upload", v) + } + return upload, nil +} -- cgit