service

package
v0.0.0-...-c3d0792 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MediaDbClient

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

MediaDbClient contains the AWS S3 client and bucket name to use for the database.

func NewMediaDbClient

func NewMediaDbClient(mediaDbConfig *cfg.MediaDbConfig) (*MediaDbClient, error)

NewMediaDbClient creates a MediaDbClient from the settings in the given MediaDbConfig. Any problem loading the AWS credentials, configuration, or accessing the S3 bucket will return a non-nil error.

func (*MediaDbClient) Create

func (cl *MediaDbClient) Create(media schema.Media) error

Create makes a single new media object in the database. It returns a non-nil error if the object cannot be added.

func (*MediaDbClient) Delete

func (cl *MediaDbClient) Delete(id string, media schema.Media) error

Delete removes the given media from the database. It returns a non-nil error if the entry cannot be deleted.

func (*MediaDbClient) Read

func (cl *MediaDbClient) Read(id string, mediaType schema.Media) ([]schema.Media, error)

Read retrieves the media entries from the database that match the specified filters. If id is the empty string "" and mediaType is nil, there is no filtering applied. If id is not the empty string, mediaType should match the type of media corresponding to that id. If id is the empty string and mediaType is not nil, all media of that type will be returned. It returns a slice of media entries upon success and a non-nil error upon failure.

func (*MediaDbClient) Update

func (cl *MediaDbClient) Update(id string, newMedia schema.Media) error

Update changes a single existing media object in the database. It returns a non-nil error if the object cannot be updated.

Jump to

Keyboard shortcuts

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