Documentation ¶
Index ¶
- type Database
- func (d Database) GetMediaMetadata(ctx context.Context, mediaID types.MediaID, mediaOrigin spec.ServerName) (*types.MediaMetadata, error)
- func (d Database) GetMediaMetadataByHash(ctx context.Context, mediaHash types.Base64Hash, mediaOrigin spec.ServerName) (*types.MediaMetadata, error)
- func (d Database) GetThumbnail(ctx context.Context, mediaID types.MediaID, mediaOrigin spec.ServerName, ...) (*types.ThumbnailMetadata, error)
- func (d Database) GetThumbnails(ctx context.Context, mediaID types.MediaID, mediaOrigin spec.ServerName) ([]*types.ThumbnailMetadata, error)
- func (d Database) StoreMediaMetadata(ctx context.Context, mediaMetadata *types.MediaMetadata) error
- func (d Database) StoreThumbnail(ctx context.Context, thumbnailMetadata *types.ThumbnailMetadata) error
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 ¶
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.