FileUploader interface #2265
Replies: 1 comment
-
I do not think this is something that would be Echo responsibility. Interfaces should be created places where you need and use multiple implementations. In that way you can create interface with least amount of methods that you need in your package and can omit all other methods that are not relevant for you on those structs. Also - uploading a file to somewhere is not specific to Echo. This is common functionality for any framework/library dealing with HTTP. So you would use same code with Echo as you would use with Gin etc therefore it would be better to it separately from Echo. Possibly in some library that provides all those (AWS s3, Google Cloud Storage, minio) implementations. |
Beta Was this translation helpful? Give feedback.
-
Can we define a
FileUploader
orFileSaver
interface?This can help us in creating different file uploaders for echo package, for example
AWS s3
,Google Cloud Storage
,minio
, etc.The API can be something like that:
And we should be able to pass custom uploaders to Echo.
I used to be a Django developer before coming to Golang. We had something like this and multiple packages for implementing different uploaders.
Beta Was this translation helpful? Give feedback.
All reactions