mirror of
https://github.com/stashapp/stash.git
synced 2025-12-15 21:03:22 +01:00
* Update to go 1.19 * Update dependencies * Update cross-compile script * Add missing targets to cross-compile-all * Update cache action to remove warning
27 lines
431 B
Go
27 lines
431 B
Go
package graphql
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
)
|
|
|
|
type Upload struct {
|
|
File io.ReadSeeker
|
|
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
|
|
}
|