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 CovenantS3 ¶
type CovenantS3 struct {
// contains filtered or unexported fields
}
CovenantS3 is an CovenantS3 file storage.
func NewCovenantS3 ¶
func NewCovenantS3(dsn, configFile, masterKey, httpEndpoint, bucket string) (*CovenantS3, error)
NewCovenantS3 returns a new CovenantS3 file storage.
func (*CovenantS3) GetHTTPHandler ¶
func (s *CovenantS3) GetHTTPHandler(stripPrefix string) http.HandlerFunc
GetHTTPHandler returns the static http.HandlerFunc
func (*CovenantS3) Migrate ¶
func (s *CovenantS3) Migrate() error
Migrate ensures the tables is created.
func (*CovenantS3) Remove ¶
func (s *CovenantS3) Remove(path string) error
Remove removes the file with the given path.
func (*CovenantS3) Save ¶
func (s *CovenantS3) Save(path string, r io.Reader) error
Save saves data from r to file with the given path.
func (*CovenantS3) URL ¶
func (s *CovenantS3) URL(path string) string
URL returns an URL of the file with the given path.
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.