Help us shape the future of Go! Take the 2026 Go Developer Survey

database

package
v1.29.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingEntClient indicates that no ent client was available in context when required.
	ErrMissingEntClient = errors.New("database storage requires ent client in context")
	// ErrMissingFileIdentifier indicates neither file ID nor key was supplied for an operation.
	ErrMissingFileIdentifier = errors.New("file identifier required for database storage operation")
	// ErrTokenManagerRequired indicates presigned URL generation attempted without a token manager.
	ErrTokenManagerRequired = errors.New("token manager required for database presigned urls")
	// ErrFileNotFound is returned when the requested file does not exist or has no stored bytes.
	ErrFileNotFound = errors.New("file not found in database storage")
	// ErrDatabaseProviderRequiresProxyPresign indicates that the database storage provider requires proxy presigning to be enabled.
	ErrDatabaseProviderRequiresProxyPresign = errors.New("database storage provider requires proxy presign to be enabled")
)

Functions

This section is empty.

Types

type Builder

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

Builder creates database providers for the client pool.

func NewBuilder

func NewBuilder() *Builder

NewBuilder returns a new database provider builder.

func (*Builder) Build

Build implements eddy.Builder.

func (*Builder) ProviderType

func (b *Builder) ProviderType() string

ProviderType implements eddy.Builder.

func (*Builder) WithOptions

func (b *Builder) WithOptions(opts ...Option) *Builder

WithOptions allows applying builder-specific options.

type Option

type Option func(*Builder)

Option configures the database provider builder.

func WithTokenClaims

func WithTokenClaims(issuer, audience string) Option

WithTokenClaims configures issuer and audience values for presigned tokens.

func WithTokenManager

func WithTokenManager(tm *tokens.TokenManager) Option

WithTokenManager supplies the token manager used for presigned URL generation.

type Provider

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

Provider persists file bytes directly into the database.

func (*Provider) Close

func (p *Provider) Close() error

Close satisfies the Provider interface. No resources to release.

func (*Provider) Delete

Delete removes file bytes from the database while retaining metadata.

func (*Provider) Download

Download retrieves file contents from the database.

func (*Provider) Exists

func (p *Provider) Exists(ctx context.Context, fileRef *storagetypes.File) (bool, error)

Exists checks whether file bytes are present in the database.

func (*Provider) GetPresignedURL

func (p *Provider) GetPresignedURL(ctx context.Context, fileRef *storagetypes.File, opts *storagetypes.PresignedURLOptions) (string, error)

GetPresignedURL returns a signed URL that proxies through the application for download.

func (*Provider) GetScheme

func (p *Provider) GetScheme() *string

GetScheme identifies the provider URI scheme.

func (*Provider) ListBuckets

func (p *Provider) ListBuckets() ([]string, error)

ListBuckets returns the configured logical bucket for the provider.

func (*Provider) ProviderType

func (p *Provider) ProviderType() storagetypes.ProviderType

ProviderType returns the database provider identifier.

func (*Provider) Upload

Upload stores file contents in the database for the ent file identified by provider hints.

Jump to

Keyboard shortcuts

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