Documentation ¶
Index ¶
- Variables
- type Bucket
- type BucketClient
- func (o *BucketClient) Delete(ctx context.Context, key string) error
- func (o *BucketClient) DownloadUrl(ctx context.Context, key string, opts ...PresignUrlOption) (string, error)
- func (b *BucketClient) ListFiles(ctx context.Context) ([]string, error)
- func (b *BucketClient) Name() string
- func (o *BucketClient) Read(ctx context.Context, key string) ([]byte, error)
- func (o *BucketClient) UploadUrl(ctx context.Context, key string, opts ...PresignUrlOption) (string, error)
- func (o *BucketClient) Write(ctx context.Context, key string, content []byte) error
- type BucketClientIface
- type BucketPermission
- type Ctx
- type EventType
- type FileResponse
- type Mode
- type PresignUrlOption
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var BucketEverything []BucketPermission = []BucketPermission{BucketRead, BucketWrite, BucketDelete}
View Source
var EventTypes = []EventType{WriteNotification, DeleteNotification}
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket interface { // Allow requests the given permissions to the bucket. Allow(permission BucketPermission, permissions ...BucketPermission) *BucketClient // On registers a handler for a specific event type on the bucket. // Valid function signatures for handler are: // // func() // func() error // func(*storage.Ctx) // func(*storage.Ctx) error // Handler[storage.Ctx] On(eventType EventType, notificationPrefixFilter string, handler interface{}) }
type BucketClient ¶
type BucketClient struct {
// contains filtered or unexported fields
}
func NewBucketClient ¶
func NewBucketClient(name string) (*BucketClient, error)
func (*BucketClient) DownloadUrl ¶
func (o *BucketClient) DownloadUrl(ctx context.Context, key string, opts ...PresignUrlOption) (string, error)
func (*BucketClient) ListFiles ¶
func (b *BucketClient) ListFiles(ctx context.Context) ([]string, error)
func (*BucketClient) Name ¶
func (b *BucketClient) Name() string
func (*BucketClient) UploadUrl ¶
func (o *BucketClient) UploadUrl(ctx context.Context, key string, opts ...PresignUrlOption) (string, error)
type BucketClientIface ¶
type BucketClientIface interface { // Name - Get the name of the bucket Name() string // ListFiles - List the files in the bucket ListFiles(ctx context.Context) ([]string, error) // Read - Read this object Read(ctx context.Context, key string) ([]byte, error) // Write - Write this object Write(ctx context.Context, key string, data []byte) error // Delete - Delete this object Delete(ctx context.Context, key string) error // UploadUrl - Creates a signed Url for uploading this file reference UploadUrl(ctx context.Context, key string, opts ...PresignUrlOption) (string, error) // DownloadUrl - Creates a signed Url for downloading this file reference DownloadUrl(ctx context.Context, key string, opts ...PresignUrlOption) (string, error) }
Cloud storage bucket resource for large file storage.
type BucketPermission ¶
type BucketPermission string
const ( BucketRead BucketPermission = "read" BucketWrite BucketPermission = "write" BucketDelete BucketPermission = "delete" )
type Ctx ¶
type Ctx struct { Request Request Response *Response Extras map[string]interface{} // contains filtered or unexported fields }
func NewCtx ¶
func NewCtx(msg *storagepb.ServerMessage) *Ctx
func (*Ctx) ToClientMessage ¶
func (c *Ctx) ToClientMessage() *storagepb.ClientMessage
type FileResponse ¶
type FileResponse struct {
Success bool
}
type PresignUrlOption ¶
type PresignUrlOption func(opts *presignUrlOptions)
func WithPresignUrlExpiry ¶
func WithPresignUrlExpiry(expiry time.Duration) PresignUrlOption
Source Files ¶
Click to show internal directories.
Click to hide internal directories.