Documentation ¶
Index ¶
- type FileStore
- type FileStoreItem
- type FileStoreOptions
- type FileStoreType
- type FileSystemStorage
- func (s *FileSystemStorage) CreateFolder(ctx context.Context, path string) (FileStoreItem, error)
- func (s *FileSystemStorage) Delete(ctx context.Context, path string) error
- func (s *FileSystemStorage) Get(ctx context.Context, path string) (FileStoreItem, error)
- func (s *FileSystemStorage) List(ctx context.Context, prefix string) ([]FileStoreItem, error)
- func (s *FileSystemStorage) Rename(ctx context.Context, path string, newPath string) (FileStoreItem, error)
- func (s *FileSystemStorage) Upload(ctx context.Context, path string, r io.Reader) (FileStoreItem, error)
- type FilestoreConfig
- type FilestoreFolder
- type GCSStorage
- func (s *GCSStorage) CreateFolder(ctx context.Context, path string) (FileStoreItem, error)
- func (s *GCSStorage) Delete(ctx context.Context, path string) error
- func (s *GCSStorage) Get(ctx context.Context, path string) (FileStoreItem, error)
- func (s *GCSStorage) List(ctx context.Context, prefix string) ([]FileStoreItem, error)
- func (s *GCSStorage) Rename(ctx context.Context, path string, newPath string) (FileStoreItem, error)
- func (s *GCSStorage) Upload(ctx context.Context, path string, r io.Reader) (FileStoreItem, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileStore ¶
type FileStore interface { // list the items at a certain path List(ctx context.Context, path string) ([]FileStoreItem, error) Get(ctx context.Context, path string) (FileStoreItem, error) CreateFolder(ctx context.Context, path string) (FileStoreItem, error) Upload(ctx context.Context, path string, r io.Reader) (FileStoreItem, error) Rename(ctx context.Context, path string, newPath string) (FileStoreItem, error) Delete(ctx context.Context, path string) error }
type FileStoreItem ¶
type FileStoreItem struct { // timestamp Created int64 `json:"created"` // bytes Size int64 `json:"size"` // is this thing a folder or not? Directory bool `json:"directory"` // the filename Name string `json:"name"` // the relative path to the file from the base path of the storage instance Path string `json:"path"` // the URL that can be used to load the object directly URL string `json:"url"` }
type FileStoreOptions ¶
type FileStoreOptions struct { Type FileStoreType LocalFSPath string GCSKeyBase64 string GCSKeyFile string GCSBucket string }
type FileStoreType ¶
type FileStoreType string
const ( FileStoreTypeLocalFS FileStoreType = "fs" FileStoreTypeLocalGCS FileStoreType = "gcs" )
type FileSystemStorage ¶
type FileSystemStorage struct {
// contains filtered or unexported fields
}
func NewFileSystemStorage ¶
func NewFileSystemStorage(basePath string, baseURL string) *FileSystemStorage
func (*FileSystemStorage) CreateFolder ¶
func (s *FileSystemStorage) CreateFolder(ctx context.Context, path string) (FileStoreItem, error)
func (*FileSystemStorage) Delete ¶
func (s *FileSystemStorage) Delete(ctx context.Context, path string) error
func (*FileSystemStorage) Get ¶
func (s *FileSystemStorage) Get(ctx context.Context, path string) (FileStoreItem, error)
func (*FileSystemStorage) List ¶
func (s *FileSystemStorage) List(ctx context.Context, prefix string) ([]FileStoreItem, error)
func (*FileSystemStorage) Rename ¶
func (s *FileSystemStorage) Rename(ctx context.Context, path string, newPath string) (FileStoreItem, error)
func (*FileSystemStorage) Upload ¶
func (s *FileSystemStorage) Upload(ctx context.Context, path string, r io.Reader) (FileStoreItem, error)
type FilestoreConfig ¶
type FilestoreConfig struct { // this will be the virtual path from the storage instance // to the users root directory // we use this to strip the full paths in the frontend so we can deal with only relative paths UserPrefix string `json:"user_prefix"` Folders []FilestoreFolder `json:"folders"` }
type FilestoreFolder ¶
top level filestore folders that have special meaning
type GCSStorage ¶
type GCSStorage struct {
// contains filtered or unexported fields
}
func NewGCSStorage ¶
func NewGCSStorage(ctx context.Context, bucketName, serviceAccountKeyFile string) (*GCSStorage, error)
func (*GCSStorage) CreateFolder ¶
func (s *GCSStorage) CreateFolder(ctx context.Context, path string) (FileStoreItem, error)
func (*GCSStorage) Get ¶
func (s *GCSStorage) Get(ctx context.Context, path string) (FileStoreItem, error)
func (*GCSStorage) List ¶
func (s *GCSStorage) List(ctx context.Context, prefix string) ([]FileStoreItem, error)
func (*GCSStorage) Rename ¶
func (s *GCSStorage) Rename(ctx context.Context, path string, newPath string) (FileStoreItem, error)
func (*GCSStorage) Upload ¶
func (s *GCSStorage) Upload(ctx context.Context, path string, r io.Reader) (FileStoreItem, error)
Click to show internal directories.
Click to hide internal directories.