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 ¶
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.