Documentation
¶
Overview ¶
Package catalogdynamo package store all the data in a single multi-tenant table:
Index ¶
- Constants
- func AlbumIndexedKeyPK(owner catalog.Owner, folderName catalog.FolderName) string
- func AlbumPrimaryKey(owner catalog.Owner, folderName catalog.FolderName) appdynamodb.TablePk
- func MediaPrimaryKey(owner catalog.Owner, id catalog.MediaId) appdynamodb.TablePk
- func Must(repository catalog.RepositoryAdapter, err error) catalog.RepositoryAdapter
- type AlbumIndexKey
- type AlbumRecord
- type MediaRecord
- type Repository
- func (r *Repository) CountMedias(albumId catalog.AlbumId) (int, error)
- func (r *Repository) DeleteEmptyAlbum(albumId catalog.AlbumId) error
- func (r *Repository) FindAlbums(ids ...catalog.AlbumId) ([]*catalog.Album, error)
- func (r *Repository) FindAlbumsByOwner(owner catalog.Owner) ([]*catalog.Album, error)
- func (r *Repository) FindExistingSignatures(owner catalog.Owner, signatures []*catalog.MediaSignature) ([]*catalog.MediaSignature, error)
- func (r *Repository) FindMediaCurrentAlbum(owner catalog.Owner, mediaId catalog.MediaId) (*catalog.AlbumId, error)
- func (r *Repository) FindMediaIds(request *catalog.FindMediaRequest) ([]catalog.MediaId, error)
- func (r *Repository) FindMedias(request *catalog.FindMediaRequest) ([]*catalog.MediaMeta, error)
- func (r *Repository) InsertAlbum(album catalog.Album) error
- func (r *Repository) InsertMedias(owner catalog.Owner, medias []catalog.CreateMediaRequest) error
- func (r *Repository) TransferMedias(owner catalog.Owner, mediaIds []catalog.MediaId, ...) error
- func (r *Repository) TransferMediasFromRecords(ctx context.Context, records catalog.MediaTransferRecords) (catalog.TransferredMedias, error)
- func (r *Repository) UpdateAlbum(album catalog.Album) error
- type RepositoryContract
Constants ¶
View Source
const (
IsoTime = "2006-01-02T15:04:05"
)
Variables ¶
This section is empty.
Functions ¶
func AlbumIndexedKeyPK ¶
func AlbumIndexedKeyPK(owner catalog.Owner, folderName catalog.FolderName) string
func AlbumPrimaryKey ¶
func AlbumPrimaryKey(owner catalog.Owner, folderName catalog.FolderName) appdynamodb.TablePk
func MediaPrimaryKey ¶
func Must ¶
func Must(repository catalog.RepositoryAdapter, err error) catalog.RepositoryAdapter
Must panics if there is an error
Types ¶
type AlbumIndexKey ¶
type AlbumIndexKey struct { AlbumIndexPK string // AlbumIndexPK is same than album's TablePk.PK AlbumIndexSK string // AlbumIndexSK identify the object within the index, and is naturally sorted }
AlbumIndexKey is a secondary key to index medias per albums
func AlbumIndexedKey ¶
func AlbumIndexedKey(owner catalog.Owner, folderName catalog.FolderName) AlbumIndexKey
func MediaAlbumIndexedKey ¶
func MediaAlbumIndexedKey(owner catalog.Owner, folderName catalog.FolderName, dateTime time.Time, id catalog.MediaId) AlbumIndexKey
type AlbumRecord ¶
type AlbumRecord struct { appdynamodb.TablePk AlbumIndexKey AlbumOwner string // AlbumOwner has been added to the data structure on 18 Apr 2022 AlbumName string AlbumFolderName string AlbumStart time.Time AlbumEnd time.Time }
type MediaRecord ¶
type MediaRecord struct { appdynamodb.TablePk AlbumIndexKey Id string // Id is the unique identifier of the media Type string // Type is either PHOTO or VIDEO DateTime time.Time // DateTime time used in AlbumIndexKey Details map[string]interface{} // Details are other attributes from domain model, stored as it Filename string // Filename is the original filename for display purpose only ; physical filename is in MediaLocationData SignatureSize int SignatureHash string }
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func (*Repository) CountMedias ¶
func (r *Repository) CountMedias(albumId catalog.AlbumId) (int, error)
CountMedias provides an accurate number of medias and can be used to update the count stored in the album record
func (*Repository) DeleteEmptyAlbum ¶
func (r *Repository) DeleteEmptyAlbum(albumId catalog.AlbumId) error
func (*Repository) FindAlbums ¶
func (*Repository) FindAlbumsByOwner ¶
func (*Repository) FindExistingSignatures ¶
func (r *Repository) FindExistingSignatures(owner catalog.Owner, signatures []*catalog.MediaSignature) ([]*catalog.MediaSignature, error)
func (*Repository) FindMediaCurrentAlbum ¶
func (*Repository) FindMediaIds ¶
func (r *Repository) FindMediaIds(request *catalog.FindMediaRequest) ([]catalog.MediaId, error)
func (*Repository) FindMedias ¶
func (r *Repository) FindMedias(request *catalog.FindMediaRequest) ([]*catalog.MediaMeta, error)
func (*Repository) InsertAlbum ¶
func (r *Repository) InsertAlbum(album catalog.Album) error
func (*Repository) InsertMedias ¶
func (r *Repository) InsertMedias(owner catalog.Owner, medias []catalog.CreateMediaRequest) error
func (*Repository) TransferMedias ¶
func (r *Repository) TransferMedias(owner catalog.Owner, mediaIds []catalog.MediaId, newFolderName catalog.FolderName) error
func (*Repository) TransferMediasFromRecords ¶ added in v1.5.33
func (r *Repository) TransferMediasFromRecords(ctx context.Context, records catalog.MediaTransferRecords) (catalog.TransferredMedias, error)
func (*Repository) UpdateAlbum ¶
func (r *Repository) UpdateAlbum(album catalog.Album) error
type RepositoryContract ¶ added in v1.5.33
type RepositoryContract interface { catalog.RepositoryAdapter catalog.TransferMediasPort }
func NewRepository ¶
func NewRepository(cfg aws.Config, tableName string) (RepositoryContract, error)
NewRepository creates the repository and connect to the database
Click to show internal directories.
Click to hide internal directories.