cloudstorage

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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,
	contentType 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