Documentation ¶
Overview ¶
Package catalog provides tools to maintain an index of all medias that have been backed up.
Index ¶
- Variables
- func Init(repositoryAdapter RepositoryAdapter)
- type Album
- type AlbumId
- type AmendAlbumDateRepositoryPort
- type AmendAlbumDates
- type AmendAlbumDatesExecutor
- type AmendAlbumDatesObserver
- type AmendAlbumDatesObserverFunc
- type AmendAlbumMediaTransfer
- type CountMediasBySelectorsFunc
- type CountMediasBySelectorsPort
- type CreateAlbum
- type CreateAlbumExecutor
- type CreateAlbumMediaTransfer
- type CreateAlbumObserver
- type CreateAlbumObserverFunc
- type CreateAlbumRequest
- type CreateMediaRequest
- type DeleteAlbum
- type DeleteAlbumMediaTransfer
- type DeleteAlbumMetadata
- type DeleteAlbumObserver
- type DeleteAlbumRepositoryFunc
- type DeleteAlbumRepositoryPort
- type FindAlbumByIdFunc
- type FindAlbumByIdPort
- type FindAlbumsByOwnerFunc
- type FindAlbumsByOwnerPort
- type FindMediaRequest
- type FolderName
- type InsertAlbumPort
- type InsertAlbumPortFunc
- type InsertMedias
- type InsertMediasObserver
- type InsertMediasRepositoryPort
- type MediaDetails
- type MediaId
- type MediaMeta
- type MediaOrientation
- type MediaPage
- type MediaSelector
- type MediaSignature
- type MediaTransfer
- type MediaTransferExecutor
- type MediaTransferFunc
- type MediaTransferRecords
- type MediaType
- type MoveMediaPort
- type MoveMediaPortFunc
- type PageRequest
- type PrioritySegment
- type RenameAlbum
- type RenameAlbumObserver
- type RenameAlbumReplacer
- type RenameAlbumRequest
- type RepositoryAdapter
- type TimeRange
- type Timeline
- func (t *Timeline) AppendAlbum(album *Album) (*Timeline, error)
- func (t *Timeline) FindAllAt(date time.Time) []*Album
- func (t *Timeline) FindAt(date time.Time) (*Album, bool)
- func (t *Timeline) FindBetween(start, end time.Time) (segments []PrioritySegment, missed []PrioritySegment)
- func (t *Timeline) FindForAlbum(albumId AlbumId) (segments []PrioritySegment)
- func (t *Timeline) FindSegmentsBetween(start, end time.Time) (segments []PrioritySegment)
- func (t *Timeline) FindSegmentsBetweenAndFilter(start, end time.Time, albumId AlbumId) (segments []PrioritySegment)
- type TimelineMutationObserver
- type TimelineMutationObserverFunc
- type TimelineMutator
- func (t TimelineMutator) AddNew(currentAlbums []*Album, addedAlbum Album) (MediaTransferRecords, error)
- func (t TimelineMutator) AmendDates(timeline []*Album, amendedAlbum Album) (MediaTransferRecords, []MediaSelector, error)
- func (t TimelineMutator) RemoveAlbum(currentAlbums []*Album, deletedAlbumId AlbumId) (MediaTransferRecords, []MediaSelector, error)
- type TransferMediasFunc
- type TransferMediasRepositoryPort
- type TransferredMedias
- type UpdateAlbumNamePort
Constants ¶
This section is empty.
Variables ¶
var ( AlbumNameMandatoryErr = errors.New("Album name is mandatory") AlbumStartAndEndDateMandatoryErr = errors.New("Start and End times are mandatory") AlbumEndDateMustBeAfterStartErr = errors.New("Album end must be strictly after its start") )
var ( OrphanedMediasError = errors.New("albums cannot be deleted if it make medias orphaned") AlbumIsNotEmptyError = errors.New("album is not empty") )
var ( AlbumNotFoundError = errors.New("album hasn't been found") EmptyFolderNameError = errors.New("folderName is mandatory and must be not empty") )
var (
MediaNotFoundError = fmt.Errorf("media not found")
)
Functions ¶
func Init ¶
func Init(repositoryAdapter RepositoryAdapter)
Init must be called before using this package.
Types ¶
type Album ¶
type Album struct { AlbumId Name string // Name for displaying purpose, not unique Start time.Time // Start is datetime inclusive End time.Time // End is the datetime exclusive TotalCount int // TotalCount is the number of media (of any type) // TODO is the total count appropriate on this object ?? }
Album is a logical grouping of medias ; also used to physically store media next to each others.
func FindAlbum ¶
FindAlbum get an album by its business key (its folder name), or returns AlbumNotFoundError
func FindAlbums ¶
FindAlbums get several albums by their business keys
func FindAllAlbums ¶
func FindAllAlbums(owner ownermodel.Owner) ([]*Album, error)
FindAllAlbums find all albums owned by root user
type AlbumId ¶
type AlbumId struct { Owner ownermodel.Owner FolderName FolderName }
func FindMediaOwnership ¶
func FindMediaOwnership(owner ownermodel.Owner, mediaId MediaId) (*AlbumId, error)
FindMediaOwnership returns the folderName containing the media, or AlbumNotFoundError.
func NewAlbumIdFromStrings ¶ added in v1.5.33
NewAlbumIdFromStrings creates an AlbumId from 2 strings ; it doesn't guaranty its validity, use AlbumId.IsValid to check if any error.
type AmendAlbumDateRepositoryPort ¶ added in v1.5.45
type AmendAlbumDates ¶ added in v1.5.45
type AmendAlbumDates struct { FindAlbumsByOwnerPort FindAlbumsByOwnerPort AmendAlbumDatesObservers []AmendAlbumDatesObserver }
func NewAmendAlbumDates ¶ added in v1.5.45
func NewAmendAlbumDates( findAlbumsByOwner FindAlbumsByOwnerPort, countMediasBySelectors CountMediasBySelectorsPort, amendAlbumDateRepository AmendAlbumDateRepositoryPort, transferMedias TransferMediasRepositoryPort, timelineMutationObservers ...TimelineMutationObserver, ) *AmendAlbumDates
func (*AmendAlbumDates) AmendAlbumDates ¶ added in v1.5.45
type AmendAlbumDatesExecutor ¶ added in v1.5.45
type AmendAlbumDatesExecutor struct {
AmendAlbumDateRepository AmendAlbumDateRepositoryPort
}
func (*AmendAlbumDatesExecutor) OnAlbumDatesAmended ¶ added in v1.5.45
type AmendAlbumDatesObserver ¶ added in v1.5.45
type AmendAlbumDatesObserverFunc ¶ added in v1.5.45
type AmendAlbumDatesObserverFunc func(ctx context.Context, existingTimeline []*Album, updatedAlbum Album) error
func (AmendAlbumDatesObserverFunc) OnAlbumDatesAmended ¶ added in v1.5.45
type AmendAlbumMediaTransfer ¶ added in v1.5.45
type AmendAlbumMediaTransfer struct { CountMediasBySelectors CountMediasBySelectorsPort MediaTransfer MediaTransfer }
func (*AmendAlbumMediaTransfer) OnAlbumDatesAmended ¶ added in v1.5.45
type CountMediasBySelectorsFunc ¶ added in v1.5.41
type CountMediasBySelectorsFunc func(ctx context.Context, owner ownermodel.Owner, selectors []MediaSelector) (int, error)
func (CountMediasBySelectorsFunc) CountMediasBySelectors ¶ added in v1.5.41
func (f CountMediasBySelectorsFunc) CountMediasBySelectors(ctx context.Context, owner ownermodel.Owner, selectors []MediaSelector) (int, error)
type CountMediasBySelectorsPort ¶ added in v1.5.41
type CountMediasBySelectorsPort interface {
CountMediasBySelectors(ctx context.Context, owner ownermodel.Owner, selectors []MediaSelector) (int, error)
}
type CreateAlbum ¶
type CreateAlbum struct {
Observers []CreateAlbumObserver
}
func NewAlbumCreate ¶ added in v1.5.42
func NewAlbumCreate( FindAlbumsByOwnerPort FindAlbumsByOwnerPort, InsertAlbumPort InsertAlbumPort, TransferMediasPort TransferMediasRepositoryPort, TimelineMutationObservers ...TimelineMutationObserver, ) *CreateAlbum
NewAlbumCreate creates the service to create a new album, including the transfer of medias
func (*CreateAlbum) Create ¶ added in v1.5.33
func (c *CreateAlbum) Create(ctx context.Context, request CreateAlbumRequest) (*AlbumId, error)
Create creates a new album
type CreateAlbumExecutor ¶ added in v1.5.42
type CreateAlbumExecutor struct {
InsertAlbumPort InsertAlbumPort
}
func (*CreateAlbumExecutor) ObserveCreateAlbum ¶ added in v1.5.42
func (c *CreateAlbumExecutor) ObserveCreateAlbum(ctx context.Context, album Album) error
type CreateAlbumMediaTransfer ¶ added in v1.5.42
type CreateAlbumMediaTransfer struct { MediaTransfer MediaTransfer FindAlbumsByOwnerPort FindAlbumsByOwnerPort }
func (*CreateAlbumMediaTransfer) ObserveCreateAlbum ¶ added in v1.5.42
func (c *CreateAlbumMediaTransfer) ObserveCreateAlbum(ctx context.Context, createdAlbum Album) error
type CreateAlbumObserver ¶ added in v1.5.42
type CreateAlbumObserverFunc ¶ added in v1.5.42
func (CreateAlbumObserverFunc) ObserveCreateAlbum ¶ added in v1.5.42
func (f CreateAlbumObserverFunc) ObserveCreateAlbum(ctx context.Context, album Album) error
type CreateAlbumRequest ¶ added in v1.5.33
type CreateAlbumRequest struct { Owner ownermodel.Owner Name string Start time.Time End time.Time ForcedFolderName string }
CreateAlbumRequest is a request to create a new album
func (*CreateAlbumRequest) IsValid ¶ added in v1.5.33
func (c *CreateAlbumRequest) IsValid() error
func (*CreateAlbumRequest) String ¶ added in v1.5.33
func (c *CreateAlbumRequest) String() string
type CreateMediaRequest ¶
type CreateMediaRequest struct { Id MediaId // Id is generated from its signature with GenerateMediaId(MediaSignature) Signature MediaSignature // Signature is the business key of a media FolderName FolderName // FolderName is the name of the album the media is in Filename string // Filename is a user-friendly name that have the right extension. Type MediaType Details MediaDetails }
CreateMediaRequest is the request to add a new media to an album belonging to the same Owner
type DeleteAlbum ¶
type DeleteAlbum struct { FindAlbumsByOwner FindAlbumsByOwnerPort CountMediasBySelectors CountMediasBySelectorsPort Observers []DeleteAlbumObserver }
func NewDeleteAlbum ¶ added in v1.5.41
func NewDeleteAlbum( FindAlbumsByOwner FindAlbumsByOwnerPort, CountMediasBySelectors CountMediasBySelectorsPort, TransferMediasPort TransferMediasRepositoryPort, DeleteAlbumRepository DeleteAlbumRepositoryPort, TimelineMutationObservers ...TimelineMutationObserver, ) *DeleteAlbum
NewDeleteAlbum creates a new DeleteAlbum service.
func (*DeleteAlbum) DeleteAlbum ¶ added in v1.5.41
func (d *DeleteAlbum) DeleteAlbum(ctx context.Context, albumId AlbumId) error
DeleteAlbum delete an album, medias it contains are dispatched to other albums.
type DeleteAlbumMediaTransfer ¶ added in v1.5.41
type DeleteAlbumMediaTransfer struct {
MediaTransferExecutor
}
func (*DeleteAlbumMediaTransfer) OnDeleteAlbum ¶ added in v1.5.42
func (d *DeleteAlbumMediaTransfer) OnDeleteAlbum(ctx context.Context, deletedAlbum AlbumId, records MediaTransferRecords) error
type DeleteAlbumMetadata ¶ added in v1.5.41
type DeleteAlbumMetadata struct {
DeleteAlbumRepository DeleteAlbumRepositoryPort
}
func (*DeleteAlbumMetadata) OnDeleteAlbum ¶ added in v1.5.42
func (d *DeleteAlbumMetadata) OnDeleteAlbum(ctx context.Context, deletedAlbum AlbumId, transfers MediaTransferRecords) error
type DeleteAlbumObserver ¶ added in v1.5.42
type DeleteAlbumObserver interface {
OnDeleteAlbum(ctx context.Context, deletedAlbum AlbumId, transfers MediaTransferRecords) error
}
type DeleteAlbumRepositoryFunc ¶ added in v1.5.41
func (DeleteAlbumRepositoryFunc) DeleteAlbum ¶ added in v1.5.41
func (f DeleteAlbumRepositoryFunc) DeleteAlbum(ctx context.Context, albumId AlbumId) error
type DeleteAlbumRepositoryPort ¶ added in v1.5.41
type FindAlbumByIdFunc ¶ added in v1.5.43
func (FindAlbumByIdFunc) FindAlbumById ¶ added in v1.5.43
type FindAlbumByIdPort ¶ added in v1.5.43
type FindAlbumsByOwnerFunc ¶ added in v1.5.41
func (FindAlbumsByOwnerFunc) FindAlbumsByOwner ¶ added in v1.5.41
func (f FindAlbumsByOwnerFunc) FindAlbumsByOwner(ctx context.Context, owner ownermodel.Owner) ([]*Album, error)
type FindAlbumsByOwnerPort ¶ added in v1.5.33
type FindMediaRequest ¶
type FindMediaRequest struct { Owner ownermodel.Owner AlbumFolderNames map[FolderName]interface{} // AlbumFolderNames is a set of folder names (map value is nil) Ranges []TimeRange // Ranges is optional, if empty no restriction will be applied }
FindMediaRequest is a filter that is applied to find medias within a time range.
func NewFindMediaRequest ¶
func NewFindMediaRequest(owner ownermodel.Owner) *FindMediaRequest
func (*FindMediaRequest) String ¶
func (m *FindMediaRequest) String() string
func (*FindMediaRequest) WithAlbum ¶
func (m *FindMediaRequest) WithAlbum(folderNames ...FolderName) *FindMediaRequest
func (*FindMediaRequest) WithinRange ¶
func (m *FindMediaRequest) WithinRange(start, end time.Time) *FindMediaRequest
type FolderName ¶ added in v1.5.33
type FolderName string
FolderName is a normalised ID unique per Owner
func NewFolderName ¶ added in v1.5.33
func NewFolderName(name string) FolderName
NewFolderName creates a FolderName with a normalised value ; it can still be invalid (empty)
func (FolderName) IsValid ¶ added in v1.5.33
func (n FolderName) IsValid() error
func (FolderName) String ¶ added in v1.5.33
func (n FolderName) String() string
type InsertAlbumPort ¶ added in v1.5.33
type InsertAlbumPortFunc ¶ added in v1.5.33
func (InsertAlbumPortFunc) InsertAlbum ¶ added in v1.5.33
func (f InsertAlbumPortFunc) InsertAlbum(ctx context.Context, album Album) error
type InsertMedias ¶
type InsertMedias struct { InsertMediasRepository InsertMediasRepositoryPort InsertMediasObservers []InsertMediasObserver }
InsertMedias is a use case to pre-generate ids and store media metadata
func NewInsertMedias ¶ added in v1.5.47
func NewInsertMedias( InsertMediasRepository InsertMediasRepositoryPort, InsertMediasObservers ...InsertMediasObserver, ) *InsertMedias
func (*InsertMedias) AssignIdsToNewMedias ¶ added in v1.5.47
func (i *InsertMedias) AssignIdsToNewMedias(ctx context.Context, owner ownermodel.Owner, signatures []*MediaSignature) (map[MediaSignature]MediaId, error)
AssignIdsToNewMedias filters out signatures that are already known and compute a unique ID for the others.
func (*InsertMedias) Insert ¶ added in v1.5.47
func (i *InsertMedias) Insert(ctx context.Context, owner ownermodel.Owner, medias []CreateMediaRequest) error
type InsertMediasObserver ¶ added in v1.5.47
type InsertMediasRepositoryPort ¶ added in v1.5.47
type InsertMediasRepositoryPort interface { // InsertMedias bulks insert medias InsertMedias(ctx context.Context, owner ownermodel.Owner, media []CreateMediaRequest) error }
type MediaDetails ¶
type MediaDetails struct {
Width, Height int
DateTime time.Time
Orientation MediaOrientation
Make string
Model string
GPSLatitude, GPSLongitude float64
Duration int64 // Duration is the length, in milliseconds, of a video
VideoEncoding string // VideoEncoding is the codec used to encode the video (ex: 'H264')
}
MediaDetails are extracted from the metadata within photos and videos and stored as it.
type MediaId ¶ added in v1.5.33
type MediaId string
func GenerateMediaId ¶
func GenerateMediaId(signature MediaSignature) (MediaId, error)
GenerateMediaId generate a unique ID for a media.
type MediaMeta ¶
type MediaMeta struct { Id MediaId // Id is the unique identifier to use across all domains Signature MediaSignature // Signature is the key used to get the image (or its location) Filename string // Filename original filename when image was uploaded Type MediaType Details MediaDetails }
MediaMeta is an entry (read) of a media in the catalog
type MediaOrientation ¶
type MediaOrientation string
type MediaPage ¶
type MediaPage struct { NextPage string // NextPage is empty if no other pages Content []*MediaMeta }
MediaPage is the current page MediaMeta, and the token of the next page
func ListMedias ¶
func ListMedias(albumId AlbumId, request PageRequest) (*MediaPage, error)
ListMedias return a page of medias within an album
type MediaSelector ¶ added in v1.5.33
type MediaSelector struct { //ExclusiveAlbum *AlbumId // ExclusiveAlbum is the Album in which medias are NOT (optional) FromAlbums []AlbumId // FromAlbums is a list of potential origins of medias ; is mandatory on CreateAlbum case because media are not indexed by date, only per album. Start time.Time // Start is the first date of matching medias, included End time.Time // End is the last date of matching media, excluded at the second }
func (MediaSelector) String ¶ added in v1.5.33
func (m MediaSelector) String() string
type MediaSignature ¶
func DecodeMediaId ¶
func DecodeMediaId(encodedId MediaId) (*MediaSignature, error)
DecodeMediaId reverse what the GenerateMediaId has done to find original signature.
func FindSignatures ¶
func FindSignatures(owner ownermodel.Owner, signatures []*MediaSignature) ([]*MediaSignature, error)
FindSignatures returns a list of the medias already known ; they can't be duplicated
func (MediaSignature) String ¶
func (s MediaSignature) String() string
type MediaTransfer ¶ added in v1.5.42
type MediaTransfer interface {
Transfer(ctx context.Context, records MediaTransferRecords) error
}
type MediaTransferExecutor ¶ added in v1.5.43
type MediaTransferExecutor struct { TransferMediasRepository TransferMediasRepositoryPort TimelineMutationObservers []TimelineMutationObserver }
func (*MediaTransferExecutor) Transfer ¶ added in v1.5.43
func (d *MediaTransferExecutor) Transfer(ctx context.Context, records MediaTransferRecords) error
type MediaTransferFunc ¶ added in v1.5.43
type MediaTransferFunc func(ctx context.Context, records MediaTransferRecords) error
func (MediaTransferFunc) Transfer ¶ added in v1.5.43
func (f MediaTransferFunc) Transfer(ctx context.Context, records MediaTransferRecords) error
type MediaTransferRecords ¶ added in v1.5.33
type MediaTransferRecords map[AlbumId][]MediaSelector
MediaTransferRecords is a description of all medias that needs to be moved accordingly to the Timeline change
func (MediaTransferRecords) String ¶ added in v1.5.33
func (r MediaTransferRecords) String() string
type MoveMediaPort ¶ added in v1.5.33
type MoveMediaPortFunc ¶ added in v1.5.33
type PageRequest ¶
type PrioritySegment ¶
type RenameAlbum ¶
type RenameAlbum struct { FindAlbumById FindAlbumByIdPort UpdateAlbumName UpdateAlbumNamePort RenameAlbumObservers []RenameAlbumObserver }
func NewRenameAlbum ¶ added in v1.5.43
func NewRenameAlbum( FindAlbumById FindAlbumByIdPort, UpdateAlbumName UpdateAlbumNamePort, InsertAlbumPort InsertAlbumPort, DeleteAlbumRepositoryPort DeleteAlbumRepositoryPort, TransferMedias TransferMediasRepositoryPort, TimelineMutationObservers ...TimelineMutationObserver, ) *RenameAlbum
NewRenameAlbum creates the service to rename an album
func (*RenameAlbum) RenameAlbum ¶ added in v1.5.43
func (r *RenameAlbum) RenameAlbum(ctx context.Context, request RenameAlbumRequest) error
type RenameAlbumObserver ¶ added in v1.5.43
type RenameAlbumObserver interface {
OnRenameAlbum(ctx context.Context, current AlbumId, creationRequest CreateAlbumRequest) error
}
type RenameAlbumReplacer ¶ added in v1.5.43
type RenameAlbumReplacer struct { CreateAlbum CreateAlbum MediaTransfer MediaTransfer DeleteAlbumRepositoryPort DeleteAlbumRepositoryPort }
func (*RenameAlbumReplacer) OnRenameAlbum ¶ added in v1.5.43
func (r *RenameAlbumReplacer) OnRenameAlbum(ctx context.Context, current AlbumId, creationRequest CreateAlbumRequest) error
type RenameAlbumRequest ¶ added in v1.5.43
type RenameAlbumRequest struct { CurrentId AlbumId NewName string RenameFolder bool // RenameFolder set to TRUE will create a new album with a FolderName generated from the NewName ForcedFolderName string // ForcedFolderName will create a new album with a specific FolderName (RenameFolder is ignored) }
func (RenameAlbumRequest) IsValid ¶ added in v1.5.43
func (r RenameAlbumRequest) IsValid() error
func (RenameAlbumRequest) String ¶ added in v1.5.43
func (r RenameAlbumRequest) String() string
type RepositoryAdapter ¶
type RepositoryAdapter interface { FindAlbumsByOwner(ctx context.Context, owner ownermodel.Owner) ([]*Album, error) // FindAlbumByIds only returns found albums FindAlbumByIds(ctx context.Context, ids ...AlbumId) ([]*Album, error) // FindMedias is a paginated search for media with their details FindMedias(ctx context.Context, request *FindMediaRequest) (medias []*MediaMeta, err error) // FindMediaIds is a paginated search to only get the media ids FindMediaIds(ctx context.Context, request *FindMediaRequest) (ids []MediaId, err error) // FindMediaCurrentAlbum returns the folderName the media is currently in FindMediaCurrentAlbum(ctx context.Context, owner ownermodel.Owner, mediaId MediaId) (id *AlbumId, err error) // FindExistingSignatures returns the signatures that are already known FindExistingSignatures(ctx context.Context, owner ownermodel.Owner, signatures []*MediaSignature) ([]*MediaSignature, error) }
RepositoryAdapter brings persistence layer to catalog package
type TimeRange ¶
TimeRange is of days, start is inclusive (at the second), end is exclusive (at the second)
type Timeline ¶
type Timeline struct {
// contains filtered or unexported fields
}
Timeline can be used to find to which album a media will belongs.
func NewTimeline ¶
NewTimeline creates a Timeline object used to compute overlaps between Album. List of albums must be sorted by Start date ASC (End sorting does not matter).
func (*Timeline) AppendAlbum ¶
AppendAlbum generates a new timeline from memory
func (*Timeline) FindBetween ¶
func (t *Timeline) FindBetween(start, end time.Time) (segments []PrioritySegment, missed []PrioritySegment)
FindBetween is deprecated, use FindSegmentsBetween instead
func (*Timeline) FindForAlbum ¶
func (t *Timeline) FindForAlbum(albumId AlbumId) (segments []PrioritySegment)
func (*Timeline) FindSegmentsBetween ¶ added in v1.5.41
func (t *Timeline) FindSegmentsBetween(start, end time.Time) (segments []PrioritySegment)
FindSegmentsBetween returns a list of segments between start and end date. Segments will cover the whole period, but might not have any album.
func (*Timeline) FindSegmentsBetweenAndFilter ¶ added in v1.5.45
func (t *Timeline) FindSegmentsBetweenAndFilter(start, end time.Time, albumId AlbumId) (segments []PrioritySegment)
FindSegmentsBetweenAndFilter returns a list of segments between start and end date, only segments lead by the given albumId will be returned.
type TimelineMutationObserver ¶ added in v1.5.33
type TimelineMutationObserver interface {
Observe(ctx context.Context, transfers TransferredMedias) error
}
TimelineMutationObserver will notify each observer that medias has been transferred to a different album.
type TimelineMutationObserverFunc ¶ added in v1.5.42
type TimelineMutationObserverFunc func(ctx context.Context, transfers TransferredMedias) error
func (TimelineMutationObserverFunc) Observe ¶ added in v1.5.42
func (f TimelineMutationObserverFunc) Observe(ctx context.Context, transfers TransferredMedias) error
type TimelineMutator ¶ added in v1.5.33
type TimelineMutator struct{}
TimelineMutator is used to measure the impact of a change on the timeline
func NewTimelineMutator ¶ added in v1.5.33
func NewTimelineMutator() *TimelineMutator
func (TimelineMutator) AddNew ¶ added in v1.5.33
func (t TimelineMutator) AddNew(currentAlbums []*Album, addedAlbum Album) (MediaTransferRecords, error)
func (TimelineMutator) AmendDates ¶ added in v1.5.45
func (t TimelineMutator) AmendDates(timeline []*Album, amendedAlbum Album) (MediaTransferRecords, []MediaSelector, error)
func (TimelineMutator) RemoveAlbum ¶ added in v1.5.41
func (t TimelineMutator) RemoveAlbum(currentAlbums []*Album, deletedAlbumId AlbumId) (MediaTransferRecords, []MediaSelector, error)
type TransferMediasFunc ¶ added in v1.5.41
type TransferMediasFunc func(ctx context.Context, records MediaTransferRecords) (TransferredMedias, error)
func (TransferMediasFunc) TransferMediasFromRecords ¶ added in v1.5.41
func (f TransferMediasFunc) TransferMediasFromRecords(ctx context.Context, records MediaTransferRecords) (TransferredMedias, error)
type TransferMediasRepositoryPort ¶ added in v1.5.45
type TransferMediasRepositoryPort interface {
TransferMediasFromRecords(ctx context.Context, records MediaTransferRecords) (TransferredMedias, error)
}
type TransferredMedias ¶ added in v1.5.33
TransferredMedias is a list of all medias that has be transferred to a different album in the catalog.
func (TransferredMedias) IsEmpty ¶ added in v1.5.41
func (t TransferredMedias) IsEmpty() bool