Documentation ¶
Index ¶
- Constants
- type Disk
- type S3Storage
- func (s *S3Storage) Copy(originFile, targetFile string) error
- func (s *S3Storage) DeleteDirectory(directory string) error
- func (s *S3Storage) DeleteFile(filePaths []string) error
- func (s *S3Storage) Directories(dir string) ([]string, error)
- func (s *S3Storage) Exists(file string) (bool, error)
- func (s *S3Storage) Files(dir string) ([]string, error)
- func (s *S3Storage) LastModified(file string) (time.Time, error)
- func (s *S3Storage) MakeDirectory(directory string) error
- func (s *S3Storage) Missing(file string) (bool, error)
- func (s *S3Storage) Move(oldFile, newFile string) error
- func (s *S3Storage) Put(filePath string, content []byte) error
- func (s *S3Storage) PutFile(filePath string, source filesystem.File) (string, error)
- func (s *S3Storage) PutFileAs(filePath string, source filesystem.File, name string) (string, error)
- func (s *S3Storage) ReadFile(file string) ([]byte, error)
- func (s *S3Storage) Size(file string) (int64, error)
- func (s *S3Storage) Url(file string) (string, error)
- type SQLStorage
- func (s *SQLStorage) Copy(originFilePath, targetFilePath string) error
- func (s *SQLStorage) DeleteDirectory(directoryPath string) error
- func (s *SQLStorage) DeleteFile(filePaths []string) error
- func (s *SQLStorage) Directories(directoryPath string) ([]string, error)
- func (s *SQLStorage) Exists(path string) (bool, error)
- func (s *SQLStorage) Files(directoryPath string) ([]string, error)
- func (s *SQLStorage) LastModified(filePath string) (time.Time, error)
- func (s *SQLStorage) MakeDirectory(directoryPath string) error
- func (s *SQLStorage) Move(originFilePath, targetFilePath string) error
- func (s *SQLStorage) Put(filePath string, content []byte) error
- func (s *SQLStorage) PutFile(filePath string, source string) (string, error)
- func (s *SQLStorage) ReadFile(filePath string) ([]byte, error)
- func (s *SQLStorage) Size(filePath string) (int64, error)
- func (s *SQLStorage) Url(filePath string) (string, error)
- type SqlStorageOptions
- type StaticStorage
- func (s *StaticStorage) Copy(originFile, targetFile string) error
- func (s *StaticStorage) DeleteDirectory(dirPath string) error
- func (s *StaticStorage) DeleteFile(filePaths []string) error
- func (s *StaticStorage) Directories(dirPath string) ([]string, error)
- func (s *StaticStorage) Exists(filePath string) (bool, error)
- func (s *StaticStorage) Files(dirPath string) ([]string, error)
- func (s *StaticStorage) LastModified(filePath string) (time.Time, error)
- func (s *StaticStorage) MakeDirectory(dirPath string) error
- func (s *StaticStorage) Move(originFile, targetFile string) error
- func (s *StaticStorage) Put(filePath string, content []byte) error
- func (s *StaticStorage) ReadFile(filePath string) ([]byte, error)
- func (s *StaticStorage) Size(filePath string) (int64, error)
- func (s *StaticStorage) Url(filePath string) (string, error)
- type StorageInterface
Constants ¶
View Source
const CDN = "cdn"
View Source
const DEFAULT = "default"
View Source
const DRIVER_S3 = "s3"
View Source
const DRIVER_SQL = "sql"
View Source
const DRIVER_STATIC = "static"
View Source
const PATH_SEPARATOR = "/"
View Source
const ROOT_PATH = PATH_SEPARATOR
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Disk ¶
type Disk struct { DiskName string Driver string Url string Visibility string // public, private (not implemented) // SQL options DB *sql.DB // for sql TableName string // for sql // Local options Root string // for local filesystem (not implemented) // S3 options Key string // for s3 Secret string // for s3 Region string // for s3 Bucket string // for s3 Endpoint string // for s3 // Allows you to enable the client to use path-style addressing, i.e., // https://s3.amazonaws.com/BUCKET/KEY . By default, the S3 client will use virtual // hosted bucket addressing when possible( https://BUCKET.s3.amazonaws.com/KEY ). UsePathStyleEndpoint bool // for s3 Throw bool // for s3 (not implemented) }
type S3Storage ¶
type S3Storage struct {
// contains filtered or unexported fields
}
S3Storage implements the StorageInterface for an S3 compliant file storage, i.e. AWS S3, DigitalOcean Spaces, Minio, etc
func (*S3Storage) DeleteDirectory ¶
DeleteDirectory deletes a directory
func (*S3Storage) DeleteFile ¶
func (*S3Storage) Directories ¶
Directories lists the sub-directories in the specified directory
func (*S3Storage) MakeDirectory ¶
type SQLStorage ¶ added in v0.1.0
type SQLStorage struct { DB *sql.DB FilestoreTable string URL string AutomigrateEnabled bool DebugEnabled bool // contains filtered or unexported fields }
func NewSqlStorage ¶ added in v0.1.0
func NewSqlStorage(options SqlStorageOptions) (*SQLStorage, error)
func (*SQLStorage) Copy ¶ added in v0.1.0
func (s *SQLStorage) Copy(originFilePath, targetFilePath string) error
func (*SQLStorage) DeleteDirectory ¶ added in v0.1.0
func (s *SQLStorage) DeleteDirectory(directoryPath string) error
DeleteDirectory deletes a directory
func (*SQLStorage) DeleteFile ¶ added in v0.1.0
func (s *SQLStorage) DeleteFile(filePaths []string) error
func (*SQLStorage) Directories ¶ added in v0.1.0
func (s *SQLStorage) Directories(directoryPath string) ([]string, error)
Directories lists the sub-directories in the specified directory
func (*SQLStorage) Files ¶ added in v0.1.0
func (s *SQLStorage) Files(directoryPath string) ([]string, error)
Files lists the files in the specified directory
func (*SQLStorage) LastModified ¶ added in v0.1.0
func (s *SQLStorage) LastModified(filePath string) (time.Time, error)
func (*SQLStorage) MakeDirectory ¶ added in v0.1.0
func (s *SQLStorage) MakeDirectory(directoryPath string) error
func (*SQLStorage) Move ¶ added in v0.1.0
func (s *SQLStorage) Move(originFilePath, targetFilePath string) error
func (*SQLStorage) Put ¶ added in v0.1.0
func (s *SQLStorage) Put(filePath string, content []byte) error
func (*SQLStorage) PutFile ¶ added in v0.1.0
func (s *SQLStorage) PutFile(filePath string, source string) (string, error)
type SqlStorageOptions ¶ added in v0.1.0
type StaticStorage ¶
type StaticStorage struct {
// contains filtered or unexported fields
}
StaticStorage implements StorageInterface it represents a static (read only) storage, i.e. CDN the only supported method is Url(filepath)
func (*StaticStorage) Copy ¶
func (s *StaticStorage) Copy(originFile, targetFile string) error
func (*StaticStorage) DeleteDirectory ¶
func (s *StaticStorage) DeleteDirectory(dirPath string) error
func (*StaticStorage) DeleteFile ¶
func (s *StaticStorage) DeleteFile(filePaths []string) error
func (*StaticStorage) Directories ¶
func (s *StaticStorage) Directories(dirPath string) ([]string, error)
func (*StaticStorage) Exists ¶ added in v0.2.0
func (s *StaticStorage) Exists(filePath string) (bool, error)
func (*StaticStorage) LastModified ¶
func (s *StaticStorage) LastModified(filePath string) (time.Time, error)
func (*StaticStorage) MakeDirectory ¶
func (s *StaticStorage) MakeDirectory(dirPath string) error
func (*StaticStorage) Move ¶
func (s *StaticStorage) Move(originFile, targetFile string) error
type StorageInterface ¶
type StorageInterface interface { Copy(originFile, targetFile string) error DeleteDirectory(dirPath string) error DeleteFile(filePaths []string) error Directories(dir string) ([]string, error) Exists(filePath string) (bool, error) Files(dir string) ([]string, error) MakeDirectory(dir string) error Move(originFile, targetFile string) error Put(filePath string, content []byte) error ReadFile(filePath string) ([]byte, error) Size(filePath string) (int64, error) LastModified(file string) (time.Time, error) Url(file string) (string, error) }
func NewStorage ¶
func NewStorage(disk Disk) (StorageInterface, error)
Click to show internal directories.
Click to hide internal directories.