Documentation
¶
Index ¶
- Constants
- func Contains(array []string, elem string) bool
- func Filter(slice []string, element string) []string
- type GCSUtil
- type GCSUtilImpl
- func (g *GCSUtilImpl) Delete(ctx context.Context, gcsPath string) error
- func (g *GCSUtilImpl) Download(ctx context.Context, gcsPath string) (io.ReadCloser, error)
- func (g *GCSUtilImpl) SplitURI(url string) (bucket, name string, err error)
- func (g *GCSUtilImpl) UploadFile(ctx context.Context, gcsPath, filePath, contentType string) error
Constants ¶
View Source
const (
GSPrefix = "gs://"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GCSUtil ¶
type GCSUtil interface { // Download returns an io.ReadCloser for GCS object at given gcsPath. Download(ctx context.Context, gcsPath string) (io.ReadCloser, error) // Delete deletes all objects under given gcsPath Delete(ctx context.Context, gcsPath string) error // UploadFile uploads contents of a file at filepath to gcsPath location in // GCS and sets object's contentType. // If gcsPath ends with .gz it also compresses the uploaded contents // and sets object's content type to application/gzip. UploadFile(ctx context.Context, gcsPath, filepath, contentType string) error // SplitURI takes a GCS URI and splits it into bucket and object names. If the URI does not have // the gs:// scheme, or the URI doesn't specify both a bucket and an object name, returns an error. SplitURI(url string) (bucket, name string, err error) }
GCSUtil contains helper methods for reading/writing GCS objects.
type GCSUtilImpl ¶
type GCSUtilImpl struct{}
func (*GCSUtilImpl) Delete ¶
func (g *GCSUtilImpl) Delete(ctx context.Context, gcsPath string) error
func (*GCSUtilImpl) Download ¶
func (g *GCSUtilImpl) Download(ctx context.Context, gcsPath string) (io.ReadCloser, error)
func (*GCSUtilImpl) SplitURI ¶
func (g *GCSUtilImpl) SplitURI(url string) (bucket, name string, err error)
func (*GCSUtilImpl) UploadFile ¶
func (g *GCSUtilImpl) UploadFile(ctx context.Context, gcsPath, filePath, contentType string) error
Click to show internal directories.
Click to hide internal directories.