catalogdynamo

package
v1.9.64 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package catalogdynamo package store all the data in a single multi-tenant table:

Index

Constants

View Source
const (
	IsoTime = "2006-01-02T15:04:05"
)

Variables

This section is empty.

Functions

func AlbumIndexedKeyPK

func AlbumIndexedKeyPK(owner ownermodel.Owner, folderName catalog.FolderName) string

func AlbumPrimaryKey

func AlbumPrimaryKey(owner ownermodel.Owner, folderName catalog.FolderName) appdynamodb.TablePk

func CoverPrimaryKey added in v1.9.63

func CoverPrimaryKey(owner ownermodel.Owner, folderName catalog.FolderName) appdynamodb.TablePk

func MediaPrimaryKey

func MediaPrimaryKey(owner ownermodel.Owner, id catalog.MediaId) appdynamodb.TablePk

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 ownermodel.Owner, folderName catalog.FolderName) AlbumIndexKey

func MediaAlbumIndexedKey

func MediaAlbumIndexedKey(owner ownermodel.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 CoverRecord added in v1.9.63

type CoverRecord struct {
	appdynamodb.TablePk
	AlbumOwner      string
	AlbumFolderName string
	Covers          []CoverRecordItem
}

CoverRecord persists the whole ordered cover set of an album as a single DynamoDB item. See ADR / DATA_MODEL.md.

type CoverRecordItem added in v1.9.63

type CoverRecordItem struct {
	MediaId  string
	Filename string
	Origin   string
}

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 NewRepository

func NewRepository(client *dynamodb.Client, tableName string) *Repository

NewRepository creates the repository and connect to the database

func (*Repository) AmendDates added in v1.5.45

func (r *Repository) AmendDates(ctx context.Context, albumId catalog.AlbumId, start, end time.Time) error

func (*Repository) CountMedia added in v1.5.50

func (r *Repository) CountMedia(ctx context.Context, album ...catalog.AlbumId) (map[catalog.AlbumId]int, error)

func (*Repository) CountMediasBySelectors added in v1.5.41

func (r *Repository) CountMediasBySelectors(ctx context.Context, owner ownermodel.Owner, selectors []catalog.MediaSelector) (int, error)

func (*Repository) DeleteAlbum added in v1.5.41

func (r *Repository) DeleteAlbum(ctx context.Context, albumId catalog.AlbumId) error

func (*Repository) FindAlbumById added in v1.5.43

func (r *Repository) FindAlbumById(ctx context.Context, id catalog.AlbumId) (*catalog.Album, error)

func (*Repository) FindAlbumByIds added in v1.5.43

func (r *Repository) FindAlbumByIds(ctx context.Context, ids ...catalog.AlbumId) ([]*catalog.Album, error)

func (*Repository) FindAlbumsByOwner

func (r *Repository) FindAlbumsByOwner(ctx context.Context, owner ownermodel.Owner) ([]*catalog.Album, error)

func (*Repository) FindCoversByAlbum added in v1.9.63

func (r *Repository) FindCoversByAlbum(ctx context.Context, albumId catalog.AlbumId) ([]catalog.Cover, error)

func (*Repository) FindCoversByAlbums added in v1.9.63

func (r *Repository) FindCoversByAlbums(ctx context.Context, albumIds ...catalog.AlbumId) (map[catalog.AlbumId][]catalog.Cover, error)

FindCoversByAlbums batches a BatchGetItem over the canonical cover record of each album. Missing covers are omitted from the result map (an album with no cover record is simply not present in the output).

func (*Repository) FindMediaCurrentAlbum

func (r *Repository) FindMediaCurrentAlbum(ctx context.Context, owner ownermodel.Owner, mediaId catalog.MediaId) (*catalog.AlbumId, error)

func (*Repository) FindMedias

func (r *Repository) FindMedias(ctx context.Context, request *catalog.FindMediaRequest) ([]*catalog.MediaMeta, error)

func (*Repository) FindSignatures added in v1.5.54

func (r *Repository) FindSignatures(ctx context.Context, owner ownermodel.Owner, signatures []catalog.MediaSignature) (map[catalog.MediaSignature]catalog.MediaId, error)

func (*Repository) InsertAlbum

func (r *Repository) InsertAlbum(ctx context.Context, album catalog.Album) error

func (*Repository) InsertMedias

func (r *Repository) InsertMedias(ctx context.Context, owner ownermodel.Owner, medias []catalog.CreateMediaRequest) error

func (*Repository) MoveCovers added in v1.9.63

func (r *Repository) MoveCovers(ctx context.Context, from, to catalog.AlbumId) error

MoveCovers relocates the canonical cover record of an album from one AlbumId to another. It preserves the ordered cover set verbatim (no reconciliation, no redraw) and is a no-op when the source album has no cover record. When from and to resolve to the same key, the record is left untouched.

func (*Repository) SaveCovers added in v1.9.63

func (r *Repository) SaveCovers(ctx context.Context, albumId catalog.AlbumId, covers []catalog.Cover) error

func (*Repository) TransferMediasFromRecords added in v1.5.33

func (r *Repository) TransferMediasFromRecords(ctx context.Context, records catalog.MediaTransferRecords) (map[catalog.AlbumId][]catalog.MediaId, error)

func (*Repository) UpdateAlbumName added in v1.5.43

func (r *Repository) UpdateAlbumName(ctx context.Context, albumId catalog.AlbumId, newName string) (catalog.Album, catalog.Album, error)

Jump to

Keyboard shortcuts

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