Files
stash/vendor/github.com/99designs/gqlgen/graphql/upload.go
WithoutPants 3dcc23c001 Fix arm32v6 build (#3501)
* Downgrade gqlgen to v0.17.2

The current version of gqlgen (v0.17.24) gives SIGILL crashes on armv7.

* Update gqlparser
2023-03-02 14:25:59 +11:00

28 lines
427 B
Go

package graphql
import (
"fmt"
"io"
)
type Upload struct {
File io.Reader
Filename string
Size int64
ContentType string
}
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
}