diff options
author | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-06-29 23:21:56 +0200 |
---|---|---|
committer | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-06-29 23:21:56 +0200 |
commit | 1ae70dbd9124675d4a510954619b01edd5f1f6c3 (patch) | |
tree | e6db7f5553a00094d048b6a4d03163853a5a4e7c /pkg/database/repository/media.go | |
parent | 024da3e546e98cbaeea5f7bc86af12b671996f41 (diff) | |
download | lens-1ae70dbd9124675d4a510954619b01edd5f1f6c3.tar.gz lens-1ae70dbd9124675d4a510954619b01edd5f1f6c3.tar.bz2 lens-1ae70dbd9124675d4a510954619b01edd5f1f6c3.zip |
ref: Move away other repositories
Finish moving all repositories to a repository package. This should
reduce the amount of packages.
Diffstat (limited to 'pkg/database/repository/media.go')
-rw-r--r-- | pkg/database/repository/media.go | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/pkg/database/repository/media.go b/pkg/database/repository/media.go new file mode 100644 index 0000000..2e94ff3 --- /dev/null +++ b/pkg/database/repository/media.go @@ -0,0 +1,64 @@ +package repository + +import ( + "context" + "strings" + "time" +) + +type ( + Media struct { + ID uint + Name string + Path string + PathHash string + MIMEType string + } + + MediaEXIF struct { + Width *float64 + Height *float64 + Description *string + Camera *string + Maker *string + Lens *string + DateShot *time.Time + Exposure *float64 + Aperture *float64 + Iso *int64 + FocalLength *float64 + Flash *int64 + Orientation *int64 + ExposureProgram *int64 + GPSLatitude *float64 + GPSLongitude *float64 + } + + Pagination struct { + Page int + Size int + } + + CreateMedia struct { + Name string + Path string + PathHash string + MIMEType string + } + + MediaRepository interface { + Create(context.Context, *CreateMedia) error + Exists(context.Context, string) (bool, error) + List(context.Context, *Pagination) ([]*Media, error) + Get(context.Context, string) (*Media, error) + GetPath(context.Context, string) (string, error) + + GetEmptyEXIF(context.Context, *Pagination) ([]*Media, error) + GetEXIF(context.Context, uint) (*MediaEXIF, error) + CreateEXIF(context.Context, uint, *MediaEXIF) error + } +) + +func (m *Media) IsVideo() bool { + return strings.HasPrefix(m.MIMEType, "video") +} |