store

package
v0.0.0-...-8cdc3bd Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBStore

type DBStore struct {
	DB *gorm.DB
}

DBStore implements the Store interface

func (*DBStore) AssignFaceToBox

func (store *DBStore) AssignFaceToBox(boxID int, faceName string) (entity.Box, error)

AssignFaceToBox takes a box and the name of a person and assigns that face to the box

func (*DBStore) ClassifyFaces

func (store *DBStore) ClassifyFaces() error

ClassifyFaces runs the automatic face recognition engine

func (*DBStore) CreateJoke

func (store *DBStore) CreateJoke(jokeString string) error

CreateJoke creates a joke in the database

func (*DBStore) CreatePhoto

func (store *DBStore) CreatePhoto(filename string, uploadedFile *multipart.FileHeader, unixTime int64) error

CreatePhoto takes a filname to a newly updated photo and does:

  1. gets EXIF information
  2. labels the image using the tensorflow object detection package
  3. adds the entry to the database

func (*DBStore) CreatePhotoFromMobile

func (store *DBStore) CreatePhotoFromMobile(filename string, uploadedFile *multipart.FileHeader, info map[string]interface{}) error

CreatePhotoFromMobile functions identically to CreatePhoto but uses EXIF data in the 'info' json object

func (*DBStore) DeleteBox

func (store *DBStore) DeleteBox(box entity.Box) error

DeleteBox deletes the box's photo and removes the entry from the database

func (*DBStore) DeleteJoke

func (store *DBStore) DeleteJoke(jokeID int) error

DeleteJoke deletes a specific joke by ID from the database

func (*DBStore) DeletePhoto

func (store *DBStore) DeletePhoto(photoID int) error

DeletePhoto deletes a specific photo by ID

func (*DBStore) GetFace

func (store *DBStore) GetFace(faceID int) (entity.Face, error)

GetFace gets all photos for a particular face

func (*DBStore) GetFaces

func (store *DBStore) GetFaces() ([]*entity.Face, error)

GetFaces gets a list of all faces

func (*DBStore) GetJokes

func (store *DBStore) GetJokes() ([]*entity.Joke, error)

GetJokes gets all jokes

func (*DBStore) GetLabel

func (store *DBStore) GetLabel(labelID int) (entity.Label, error)

GetLabel gets a specific labelID and returns information about the label and all photos tagged with that label

func (*DBStore) GetLabels

func (store *DBStore) GetLabels() ([]*entity.Label, error)

GetLabels gets a list of all labels that contain a non-zero number of photos

func (*DBStore) GetPhoto

func (store *DBStore) GetPhoto(photoID int) (entity.Photo, error)

GetPhoto gets a specific photo by id

func (*DBStore) GetPhotos

func (store *DBStore) GetPhotos() ([]*entity.Photo, error)

GetPhotos gets all photos

func (*DBStore) GetPhotosByMonth

func (store *DBStore) GetPhotosByMonth(offset int) ([]*MonthPhotoPair, error)

GetPhotosByMonth gets all photos and partitions them by (month, year) pairs

func (*DBStore) GetPhotosByMonthSlow

func (store *DBStore) GetPhotosByMonthSlow() ([]*MonthPhotoPair, error)

GetPhotosByMonthSlow is an older implementation of GetPhotosByMonth that uses sorting

func (*DBStore) GetUnassignedBoxes

func (store *DBStore) GetUnassignedBoxes() ([]*entity.Box, error)

GetUnassignedBoxes gets all boxes that are not assigned to a person

func (*DBStore) IsDuplicatePhoto

func (store *DBStore) IsDuplicatePhoto(info map[string]interface{}) bool

IsDuplicatePhoto uses the metadata to determine if this photo is already stored

func (*DBStore) LikeJoke

func (store *DBStore) LikeJoke(jokeID int) error

LikeJoke increments the like count of a specific joke

func (*DBStore) Search

func (store *DBStore) Search(query string) (SearchResult, error)

Search performs a search of a query entered by the user

type MonthPhotoPair

type MonthPhotoPair struct {
	Month  string
	Photos []*entity.Photo
}

MonthPhotoPair represents the pair (month, photos taken on month)

type SearchResult

type SearchResult struct {
	Labels []*entity.Label
	Faces  []*entity.Face
	Photos []*entity.Photo
}

SearchResult represents the pair (month, photos taken on month)

type Store

type Store interface {
	CreateJoke(jokeString string) error
	DeleteJoke(jokeID int) error
	LikeJoke(jokeID int) error
	GetJokes() ([]*entity.Joke, error)

	CreatePhoto(filename string, uploadedFile *multipart.FileHeader, unixTime int64) error
	CreatePhotoFromMobile(filename string, uploadedFile *multipart.FileHeader, info map[string]interface{}) error
	GetPhoto(photoID int) (entity.Photo, error)
	DeletePhoto(photoID int) error
	GetPhotos() ([]*entity.Photo, error)
	GetPhotosByMonth(offset int) ([]*MonthPhotoPair, error)
	IsDuplicatePhoto(info map[string]interface{}) bool

	GetLabels() ([]*entity.Label, error)
	GetLabel(labelID int) (entity.Label, error)

	GetFaces() ([]*entity.Face, error)
	GetFace(faceID int) (entity.Face, error)
	ClassifyFaces() error

	GetUnassignedBoxes() ([]*entity.Box, error)
	DeleteBox(box entity.Box) error
	AssignFaceToBox(boxID int, faceName string) (entity.Box, error)

	Search(query string) (SearchResult, error)
}

Store is an interface defining all methods to interact with the models:

  • Joke
  • Photo
  • Label
  • Face
  • Box

Jump to

Keyboard shortcuts

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