bucket

package
v0.1.813 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const (
	BucketWorksites = "worksites"
	BucketJobs      = "jobs"
	BucketCalls     = "calls"
	BucketReports   = "reports"
	BucketTickets   = "tickets"
	BucketContacts  = "contacts"
	BucketUsers     = "users"
	BucketChat      = "chat"
	BucketQR        = "qr"
	BucketMemos     = "memos"
)

Variables

View Source
var (
	LifeCycleTwoYears = helper.Point(int64(720))
	LifeCycleYear     = helper.Point(int64(360))
	LifeCycleHalfYear = helper.Point(int64(180))
	ObjectPathKey     = contract.ToPubSubKey("object_path")
	BucketNameKey     = contract.ToPubSubKey("bucket_name")
	ObjectModalityKey = contract.ToPubSubKey("object_modality")
	ObjectIDKey       = contract.ToPubSubKey("object_id")
	ObjectMIMEKey     = contract.ToPubSubKey("object_mime")
)

Functions

func NewGoogleStorageClient

func NewGoogleStorageClient(ctx context.Context, retryOpts helper.RetryOptions, opts StorageClientOptions) (*storage.Client, error)

Types

type Blackbox

type Blackbox interface {
	// contains filtered or unexported methods
}

type BucketName added in v0.1.485

type BucketName = string

type Client

type Client interface {
	Blackbox
	contract.BucketOperator
}

func NewClient

func NewClient(ctx context.Context, d Dependencies, opts ClientOptions) (Client, error)

func NewNoopClient added in v0.1.494

func NewNoopClient() Client

type ClientOption

type ClientOption = contract.Opt[ClientOptions]

func WithBucketLocation

func WithBucketLocation(x string) ClientOption

func WithCredentialsJSON

func WithCredentialsJSON(x []byte) ClientOption

func WithExpirationURL

func WithExpirationURL(x time.Duration) ClientOption

func WithLoaded

func WithLoaded(x Loaded) ClientOption

func WithToRegister added in v0.1.485

func WithToRegister(x ToRegister) ClientOption

type ClientOptions

type ClientOptions struct {
	Loaded
	T             ToRegister
	ExpirationURL time.Duration
}

func ApplyClientOptions

func ApplyClientOptions(opts *ClientOptions, modifiers ...ClientOption) ClientOptions

type DefaultTool

type DefaultTool struct {
	T *contract.Tool[Client]
}

func NewTool

func NewTool(c Client, opts contract.ToolOptions[Client]) *DefaultTool

func (*DefaultTool) BuildObjectPath

func (d *DefaultTool) BuildObjectPath(ctx context.Context, parts ...string) (string, error)

BuildObjectPath concatenates object path segments.

func (*DefaultTool) Close

func (d *DefaultTool) Close(ctx context.Context) error

Close closes the underlying client.

func (*DefaultTool) DefaultBucketAttrs

func (d *DefaultTool) DefaultBucketAttrs(ctx context.Context, lc *storage.Lifecycle) (*storage.BucketAttrs, error)

DefaultBucketAttrs builds default attributes for a new bucket.

func (*DefaultTool) DeleteObjectByName

func (d *DefaultTool) DeleteObjectByName(ctx context.Context, bucketName, objectName string) error

DeleteObjectByName deletes a single object from the specified bucket.

func (*DefaultTool) DeleteObjectsByQuery

func (d *DefaultTool) DeleteObjectsByQuery(ctx context.Context, bucketName string, query *storage.Query) error

DeleteObjectsByQuery deletes all objects in a bucket that match the given query.

func (*DefaultTool) EnsureBucket

EnsureBucket creates the bucket if it does not exist.

func (*DefaultTool) FindObjects

FindObjects retrieves and sorts all objects in a bucket that match the given query.

func (*DefaultTool) GenerateBucketName added in v0.1.510

func (d *DefaultTool) GenerateBucketName(ctx context.Context, e contract.EnvironmentOperator, suffix string) (string, error)

GenerateBucketName returns a new bucket name.

func (*DefaultTool) GenerateSignedObjectURLs

func (d *DefaultTool) GenerateSignedObjectURLs(ctx context.Context, opts contract.GenerateSignedObjectURLsOptions) ([]string, error)

GenerateSignedObjectURLs returns signed URLs for a list of object attributes in a bucket.

func (*DefaultTool) NewObjectQuery

func (d *DefaultTool) NewObjectQuery(ctx context.Context, parts ...string) (*storage.Query, error)

NewObjectQuery builds a new storage.Query.

func (*DefaultTool) NewSignedURLOptions

func (d *DefaultTool) NewSignedURLOptions(ctx context.Context, expire bool) (*storage.SignedURLOptions, error)

NewSignedURLOptions builds signed URL options using credentials.

func (*DefaultTool) UploadObject

func (d *DefaultTool) UploadObject(ctx context.Context, opts contract.UploadObjectOptions) error

UploadObject uploads a single object to a Google Cloud Storage bucket.

func (*DefaultTool) UploadObjects

func (d *DefaultTool) UploadObjects(ctx context.Context, opts contract.UploadObjectsOptions) error

UploadObjects uploads multiple objects to a Google Cloud Storage bucket.

type LifeCycleBase added in v0.1.488

type LifeCycleBase = *int64

type Loaded

type Loaded struct {
	CredentialsJSON []byte
	BucketLocation  string
	BucketPrefix    string
}

type StorageClientOptions

type StorageClientOptions struct {
	Loaded
}

type ToRegister added in v0.1.485

type ToRegister map[BucketName]LifeCycleBase

type Tool

type Tool interface {
	contract.BucketOperator
}

Jump to

Keyboard shortcuts

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