shared

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	DB              *sql.DB
	Writer          sqlutil.Writer
	MediaRepository tables.MediaRepository
	Thumbnails      tables.Thumbnails
}

func (*Database) GetMediaMetadata

func (d *Database) GetMediaMetadata(ctx context.Context, mediaID types.MediaID, mediaOrigin spec.ServerName) (*types.MediaMetadata, error)

GetMediaMetadata returns metadata about media stored on this server. The media could have been uploaded to this server or fetched from another server and cached here. Returns nil metadata if there is no metadata associated with this media.

func (*Database) GetMediaMetadataByHash

func (d *Database) GetMediaMetadataByHash(ctx context.Context, mediaHash types.Base64Hash, mediaOrigin spec.ServerName) (*types.MediaMetadata, error)

GetMediaMetadataByHash returns metadata about media stored on this server. The media could have been uploaded to this server or fetched from another server and cached here. Returns nil metadata if there is no metadata associated with this media.

func (*Database) GetThumbnail

func (d *Database) GetThumbnail(ctx context.Context, mediaID types.MediaID, mediaOrigin spec.ServerName, width, height int, resizeMethod string) (*types.ThumbnailMetadata, error)

GetThumbnail returns metadata about a specific thumbnail. The media could have been uploaded to this server or fetched from another server and cached here. Returns nil metadata if there is no metadata associated with this thumbnail.

func (*Database) GetThumbnails

func (d *Database) GetThumbnails(ctx context.Context, mediaID types.MediaID, mediaOrigin spec.ServerName) ([]*types.ThumbnailMetadata, error)

GetThumbnails returns metadata about all thumbnails for a specific media stored on this server. The media could have been uploaded to this server or fetched from another server and cached here. Returns nil metadata if there are no thumbnails associated with this media.

func (*Database) StoreMediaMetadata

func (d *Database) StoreMediaMetadata(ctx context.Context, mediaMetadata *types.MediaMetadata) error

StoreMediaMetadata inserts the metadata about the uploaded media into the database. Returns an error if the combination of MediaID and Origin are not unique in the table.

func (*Database) StoreThumbnail

func (d *Database) StoreThumbnail(ctx context.Context, thumbnailMetadata *types.ThumbnailMetadata) error

StoreThumbnail inserts the metadata about the thumbnail into the database. Returns an error if the combination of MediaID and Origin are not unique in the table.

Jump to

Keyboard shortcuts

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