Documentation ¶
Overview ¶
Package filestorage provides a file storage service that manages public web app files e.g. user-uploaded avatars.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AmazonS3 ¶
type AmazonS3 struct {
// contains filtered or unexported fields
}
AmazonS3 is an Amazon S3 file storage.
func NewAmazonS3 ¶
NewAmazonS3 returns a new Amazon S3 file storage.
type FileStorage ¶
type FileStorage interface { // Save saves data from r to file with the given path. Save(path string, r io.Reader) error // Remove removes the file with the given path. Remove(path string) error // URL returns an URL of the file with the given path. URL(path string) string }
FileStorage manages files uploaded by users.
type GoogleCloudStorage ¶
type GoogleCloudStorage struct {
// contains filtered or unexported fields
}
GoogleCloudStorage is a GCS-based file storage.
func NewGoogleCloudStorage ¶
func NewGoogleCloudStorage(serviceAccountFile, bucket string) (*GoogleCloudStorage, error)
NewGoogleCloudStorage returns a new GoogleCloudStorage file storage.
func (*GoogleCloudStorage) Remove ¶
func (s *GoogleCloudStorage) Remove(path string) error
Remove removes the file with the given path.
func (*GoogleCloudStorage) Save ¶
func (s *GoogleCloudStorage) Save(path string, r io.Reader) error
Save saves data from r to file with the given path.
func (*GoogleCloudStorage) URL ¶
func (s *GoogleCloudStorage) URL(path string) string
URL returns an URL of the file with the given path.
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
Local is a local file storage.
Click to show internal directories.
Click to hide internal directories.