cloud_storage

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 7 Imported by: 0

README

Usage

Installation

go get cloud.google.com/go/storage
go get google.golang.org/api/option
go get github.com/louvri/gold

Initiate Object

Import Object
import (
    cloudStorage github.com/louvri/gold/cloud_storage
)
Create Object
environment := "stg"
credential := "xxx"
contentType := "text/csv"
bucketName := "gcs-asia-southeast2-xxx"
expiryDuration := 24 * time.Hour
storage := cloudStorage.New(environment, credential, contentType, bucketName, "", expiryDuration)

Signed URL Actions

Upload File
ctx := context.Background()
filePath := "file.txt"
fileURL, err := cloudStorage.UploadByPath(ctx, filePath)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudStorage

type CloudStorage struct {
	ExpiryDuration time.Duration
	ContentType    string
	Option         []option.ClientOption
	Bucket         string
}

func (*CloudStorage) UploadByPath

func (c *CloudStorage) UploadByPath(ctx context.Context, path string) (*string, error)

type Storage added in v1.0.0

type Storage interface {
	UploadByPath(ctx context.Context, path string) (*string, error)
}

func New

func New(environment, credential, contentType, bucketName, customEndpoint string, expiryDuration time.Duration) Storage

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL