pg

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row
}

DB defines the methods the database handler must provide.

type ImageStore

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

ImageStore is an image.Store implementation that uses PostgreSQL as the underlying storage.

func NewImageStore

func NewImageStore(
	cfg *viper.Viper,
	db DB,
	hc img.HTTPClient,
	githubRL *rate.Limiter,
) *ImageStore

NewImageStore creates a new ImageStore instance.

func (*ImageStore) DownloadAndSaveImage added in v0.14.0

func (s *ImageStore) DownloadAndSaveImage(ctx context.Context, imageURL string) (string, error)

DownloadAndSaveImage implements the image.Store interface.

func (*ImageStore) GetImage

func (s *ImageStore) GetImage(ctx context.Context, imageID, version string) ([]byte, error)

GetImage returns an image stored in the database.

func (*ImageStore) SaveImage

func (s *ImageStore) SaveImage(ctx context.Context, data []byte) (string, error)

SaveImage implements the image.Store interface.

Jump to

Keyboard shortcuts

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