cs

package
v0.0.0-...-9ecd722 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package cs provides a simple API for the Google Cloud Storage service.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrObjectNotExist = errors.New("object does not exist")
	ErrBucketNotExist = errors.New("bucket does not exist")
)

Functions

This section is empty.

Types

type Attributes

type Attributes struct {
	ContentType     string
	ContentEncoding string
	Size            int64
	SizeStr         string
}

type Client

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

func New

func New(ctx context.Context, bucket string) (*Client, error)

func NewFromClient

func NewFromClient(bucket string, client *storage.Client) *Client

func (*Client) DeleteObjects

func (c *Client) DeleteObjects(ctx context.Context, q *Query) (int, error)

func (*Client) GetObjectWithData

func (c *Client) GetObjectWithData(ctx context.Context, name string) (*ObjectWithData, error)

func (*Client) GetObjects

func (c *Client) GetObjects(ctx context.Context, q *Query) ([]*Object, error)

func (*Client) WriteObject

func (c *Client) WriteObject(ctx context.Context, name string, data io.ReadCloser, attrs *Attributes) error

type Object

type Object struct {
	Name   string
	Bucket string
	Attrs  Attributes
}

type ObjectWithData

type ObjectWithData struct {
	*Object
	Data []byte
}

type Operations

type Operations interface {
	DeleteObjects(ctx context.Context, q *Query) (int, error)
	WriteObject(ctx context.Context, name string, data io.ReadCloser, attrs *Attributes) error
	GetObjects(ctx context.Context, q *Query) ([]*Object, error)
	GetObjectWithData(ctx context.Context, name string) (*ObjectWithData, error)
}

type Query

type Query struct {
	Prefix string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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