cloudstorage

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BaseURL ... GCSのURL
	BaseURL string = "https://storage.googleapis.com"

	// ChunkSize ... アップロード時の分割サイズ(メモリ不足になったら調整する)
	ChunkSize int = 200
)

Variables

This section is empty.

Functions

func GenerateFileURL

func GenerateFileURL(
	bucket string,
	path string,
	name string,
) string

GCSのファイルURLを作成する

Types

type CacheMode

type CacheMode struct {
	Disabled bool
	Expire   time.Duration
}

キャッシュ設定

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(
	bucket string,
) *Client

func (*Client) GetBucket

func (c *Client) GetBucket() string

バケット名

func (*Client) GetDownloadSignedURL added in v1.2.0

func (c *Client) GetDownloadSignedURL(
	ctx context.Context,
	path string,
	expire time.Duration,
) (string, error)

func (*Client) GetReader

func (c *Client) GetReader(
	ctx context.Context,
	path string,
) (*storage.Reader, error)

指定ファイルのReaderを取得する

func (*Client) GetUploadSignedURL added in v1.2.0

func (c *Client) GetUploadSignedURL(
	ctx context.Context,
	path string,
	contentType string,
	expire time.Duration,
) (string, error)

func (*Client) Upload

func (c *Client) Upload(
	ctx context.Context,
	path string,
	name string,
	contentType string,
	cacheMode *CacheMode,
	data []byte,
) (string, error)

ファイルをアップロードする

func (*Client) UploadForDataURL

func (c *Client) UploadForDataURL(
	ctx context.Context,
	path string,
	name string,
	cacheMode *CacheMode,
	dataURL string,
) (string, error)

DataURLのファイルをアップロードする

type UploadResponse

type UploadResponse struct {
	URL string
}

アップロードのレスポンス

Jump to

Keyboard shortcuts

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