catalogdynamo

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

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

Index

Constants

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

Variables

This section is empty.

Functions

func AlbumIndexedKeyPK

func AlbumIndexedKeyPK(owner string, folderName string) string

func MediaPrimaryKeyPK

func MediaPrimaryKeyPK(owner string, id string) string

func Must

Must panics if there is an error

func NewRepository

func NewRepository(awsSession *session.Session, tableName string) (catalog.RepositoryAdapter, error)

NewRepository creates the repository and connect to the database

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, folderName string) AlbumIndexKey

func MediaAlbumIndexedKey

func MediaAlbumIndexedKey(owner string, folderName string, dateTime time.Time, id string) AlbumIndexKey

type AlbumRecord

type AlbumRecord struct {
	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 {
	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 TablePk

type TablePk struct {
	PK string // PK is the Partition key ; see what's used depending on object types
	SK string // SK is the Sort key ; see what's used depending on object types
}

TablePk are the primary and sort keys of the table

func AlbumPrimaryKey

func AlbumPrimaryKey(owner string, folderName string) TablePk

func MediaPrimaryKey

func MediaPrimaryKey(owner string, id string) TablePk

Jump to

Keyboard shortcuts

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