Documentation
¶
Index ¶
- Variables
- func GenerateUrlFromPath(baseUrl string, filePath string) string
- func GetFileExtension(fileName string) string
- func GetFullPath(path string, name string) string
- func MD5BytesToString(bytes []byte) string
- func ObjectToUrl(baseUrl string, objAttrs *storage.ObjectAttrs) string
- type DownloadedFile
- type File
- type FileLocation
- type GCSConfig
- type GoGCSClient
- type GoGSCClient
- func (s GoGSCClient) CloneFile(sourceName, destinationName string, isRemoveSource bool) error
- func (s GoGSCClient) DownloadFiles(downloads []DownloadedFile) error
- func (s GoGSCClient) GetBaseUrl() string
- func (s GoGSCClient) GetSignedURL(objectName string, expired time.Duration) (string, error)
- func (s GoGSCClient) ListFile(path string) ([]ListFile, error)
- func (s GoGSCClient) RemoveFiles(objectNames []string) error
- func (s GoGSCClient) UploadFiles(files []File) ([]UploadedFile, error)
- type ListFile
- type UploadedFile
Constants ¶
This section is empty.
Variables ¶
View Source
var (
MapExtensionWithContentType = map[string]string{
".csv": "text/csv",
}
)
Functions ¶
func GenerateUrlFromPath ¶
func GetFileExtension ¶
func GetFullPath ¶
func MD5BytesToString ¶
func ObjectToUrl ¶
func ObjectToUrl(baseUrl string, objAttrs *storage.ObjectAttrs) string
Types ¶
type DownloadedFile ¶
type DownloadedFile struct { Object string Location *FileLocation Data []byte }
type FileLocation ¶
type GCSConfig ¶
type GCSConfig struct { Bucket string `envconfig:"GCS_BUCKET" required:"true"` ProjectID string `envconfig:"GCS_PROJECT_ID" required:"true"` BaseUrl string `envconfig:"GCS_BASE_URL" required:"true"` ServiceAccount string `envconfig:"GCS_SERVICE_ACCOUNT" required:"true"` }
func LoadGSCConfig ¶
func LoadGSCConfig() GCSConfig
type GoGCSClient ¶
type GoGCSClient interface { UploadFiles(file []File) ([]UploadedFile, error) DownloadFiles(downloads []DownloadedFile) error RemoveFiles(objectNames []string) error CloneFile(sourceName, destinationName string, isRemoveSource bool) error ListFile(path string) ([]ListFile, error) GetBaseUrl() string GetSignedURL(objectName string, expired time.Duration) (string, error) }
type GoGSCClient ¶
type GoGSCClient struct { Client *storage.Client ProjectID string Bucket string BaseUrl string ServiceAccount string Context context.Context }
func NewGCSClient ¶
func NewGCSClient(ctx context.Context) (*GoGSCClient, error)
func (GoGSCClient) CloneFile ¶
func (s GoGSCClient) CloneFile(sourceName, destinationName string, isRemoveSource bool) error
func (GoGSCClient) DownloadFiles ¶
func (s GoGSCClient) DownloadFiles(downloads []DownloadedFile) error
func (GoGSCClient) GetBaseUrl ¶
func (s GoGSCClient) GetBaseUrl() string
func (GoGSCClient) GetSignedURL ¶
func (GoGSCClient) RemoveFiles ¶
func (s GoGSCClient) RemoveFiles(objectNames []string) error
func (GoGSCClient) UploadFiles ¶
func (s GoGSCClient) UploadFiles(files []File) ([]UploadedFile, error)
type UploadedFile ¶
Click to show internal directories.
Click to hide internal directories.