repositories

package
v0.0.0-...-adb56df Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ElasticSearchRepository

type ElasticSearchRepository interface {
	InsertPhoto(ctx context.Context, photo *models.PhotoIndex) error
	BulkInsertPhotos(ctx context.Context, photos []*models.PhotoIndex) (*esutil.BulkIndexerStats, error)
	SearchPhotos(ctx context.Context, query *filters.PhotoSearchQuery) (*models.PhotoResult, error)
	AggregateByDateTimeOriginalYear(ctx context.Context) ([]*models.PhotoDateHistogram, error)
	AggregateByDateTimeOriginalYearMonth(ctx context.Context, year int) ([]*models.PhotoDateHistogram, error)
	AggregateByDateTimeOriginalYearMonthDate(ctx context.Context, year, month int) ([]*models.PhotoDateHistogram, error)
}

func NewElasticSearchRepository

func NewElasticSearchRepository(searchClient es.Search, newBulkIndexerFunc func() esutil.BulkIndexer) ElasticSearchRepository

type ExifRepository

type ExifRepository interface {
	GetPhotoMetaDataByPhotoID(ctx context.Context, photoID int) (dbmodels.ExifSlice, error)
	GetPhotoMetaItemByTagID(ctx context.Context, photoID, tagID int) (*dbmodels.Exif, error)
	GetPhotoMetaItemsByPhotoIDsTagID(ctx context.Context, photoIDs []int, tagID int) (dbmodels.ExifSlice, error)
	InsertPhotoMetaItem(ctx context.Context, exif *dbmodels.Exif) (*dbmodels.Exif, error)
	UpdatePhotoMetaItem(ctx context.Context, exif *dbmodels.Exif) (*dbmodels.Exif, error)
}

func NewExifRepository

func NewExifRepository(db mysql.SQLExecutor) ExifRepository

type OAuthClientRedirectURLRepository

type OAuthClientRedirectURLRepository interface {
	GetOAuthClientRedirectURLsByOAuthClientID(ctx context.Context, oauthClientID string) ([]*dbmodels.OauthClientRedirectURL, error)
	CreateOAuthClientRedirectURL(ctx context.Context, url *entities.OAuthClientRedirectURL) (*dbmodels.OauthClientRedirectURL, error)
}

type OAuthClientRepository

type OAuthClientRepository interface {
	GetByOauthClientID(ctx context.Context, id string) (*dbmodels.OauthClient, error)
	ExistOauthClient(ctx context.Context, id string) (bool, error)
	CreateOAuthClient(ctx context.Context, client *dbmodels.OauthClient, redirectURLs []*dbmodels.OauthClientRedirectURL) (*dbmodels.OauthClient, []*dbmodels.OauthClientRedirectURL, error)
}

func NewOAuthClientRepository

func NewOAuthClientRepository(db mysql.SQLExecutor) OAuthClientRepository

type OauthAccessTokenRepository

type OauthAccessTokenRepository interface {
	SetAccessToken(ctx context.Context, oauthAccessToken *models.OauthAccessToken, accessToken string, expireIn int64) error
	GetSession(ctx context.Context, accessToken string) (*entities.OauthSession, error)
}

func NewOauthAccessTokenRepository

func NewOauthAccessTokenRepository(db redis.Driver) OauthAccessTokenRepository

type OauthCodeRepository

type OauthCodeRepository interface {
	SetCode(ctx context.Context, code string, m *models.OauthCode) error
	GetCode(ctx context.Context, code string) (*models.OauthCode, error)
}

func NewOauthCodeRepository

func NewOauthCodeRepository(db redis.Driver) OauthCodeRepository

type PhotoFileRepository

type PhotoFileRepository interface {
	GetPhotoFileByPhotoFileID(ctx context.Context, photoFileID int) (*dbmodels.PhotoFile, error)
	GetPhotoFilesByPhotoID(ctx context.Context, photoID int) ([]*dbmodels.PhotoFile, error)
	GetPhotoFilesByPhotoIDs(ctx context.Context, photoIDs []int) ([]*dbmodels.PhotoFile, error)
	InsertPhotoFile(ctx context.Context, photoFile *dbmodels.PhotoFile) (*dbmodels.PhotoFile, error)
	UpdatePhotoFile(ctx context.Context, photoFile *dbmodels.PhotoFile) (*dbmodels.PhotoFile, error)
	GetPhotoFileByFilePath(ctx context.Context, filePath string) (*dbmodels.PhotoFile, error)
	ExistPhotoFileByFilePath(ctx context.Context, filePath string) (bool, error)
}

func NewPhotoFileRepository

func NewPhotoFileRepository(db mysql.SQLExecutor) PhotoFileRepository

type PhotoRepository

type PhotoRepository interface {
	GetPhoto(ctx context.Context, photoID int) (*dbmodels.Photo, error)
	GetPhotos(ctx context.Context, limit, offset int) ([]*dbmodels.Photo, error)
	CountPhotos(ctx context.Context) (int, error)
	GetPhotoByFilePath(ctx context.Context, fileHash string) (*dbmodels.Photo, error)
	InsertPhoto(ctx context.Context, photo *dbmodels.Photo) (*dbmodels.Photo, error)
	UpdatePhoto(ctx context.Context, photo *dbmodels.Photo) (*dbmodels.Photo, error)
}

func NewPhotoRepository

func NewPhotoRepository(db mysql.SQLExecutor) PhotoRepository

type PhotoStorageRepository

type PhotoStorageRepository interface {
	SaveContent(userID, fileName string, dateTimeOriginal time.Time, data []byte) (os.FileInfo, string, error)
	ReadDir(dirPath string) ([]os.FileInfo, error)
	LoadContent(path string) ([]byte, error)
	ParsePhotoMetaFromFile(path string) ([]models.IfdEntry, error)
	CreateUserDir(userID string) error
}

func NewPhotoStorageRepository

func NewPhotoStorageRepository(driver storage.Driver) PhotoStorageRepository

type PhotoThumbnailRepository

type PhotoThumbnailRepository interface {
	SavePreview(ctx context.Context, photoID int, data []byte) error
	SaveThumbnail(ctx context.Context, photoID int, data []byte) error
}

func NewPhotoThumbnailRepository

func NewPhotoThumbnailRepository(fileDriver storage.Driver, db mysql.SQLExecutor) PhotoThumbnailRepository

type PhotoUploadSignRepository

type PhotoUploadSignRepository interface {
	GetSign(ctx context.Context, token string) (*models.PhotoUploadSign, error)
	SetSignToken(ctx context.Context, token, userID string, expireIn int64) error
}

func NewPhotoUploadSignRepository

func NewPhotoUploadSignRepository(db redis.Driver) PhotoUploadSignRepository

type UserAuthRepository

type UserAuthRepository interface {
	UpsertUserAuth(ctx context.Context, m *dbmodels.UserAuth, refreshTokenRaw string) (*dbmodels.UserAuth, error)
	GetUserAuth(ctx context.Context, userID, clientID string) (*dbmodels.UserAuth, error)
	GetUserAuthByRefreshToken(ctx context.Context, refreshToken string) (*dbmodels.UserAuth, error)
	DeleteUserAuth(ctx context.Context, userID, clientID string) error
	DeleteClientAllAuth(ctx context.Context, clientID string) error
}

func NewUserAuthRepository

func NewUserAuthRepository(db mysql.SQLExecutor) UserAuthRepository

type UserPasswordRepository

type UserPasswordRepository interface {
	GetUserPassword(ctx context.Context, userID string) (*dbmodels.UserPassword, error)
}

func NewUserPasswordRepository

func NewUserPasswordRepository(db mysql.SQLExecutor) UserPasswordRepository

type UserRepository

type UserRepository interface {
	GetUser(ctx context.Context, userID string) (*dbmodels.User, error)
	GetUsers(ctx context.Context, filter *filters.UserFilter, limit, offset int) ([]*dbmodels.User, error)
	CountUsers(ctx context.Context, filter *filters.UserFilter) (int, error)
	ExistUser(ctx context.Context, userID string) (bool, error)
	CreateUser(ctx context.Context, user *dbmodels.User, password *dbmodels.UserPassword) (*dbmodels.User, error)
	UpdateUserProfile(ctx context.Context, user *dbmodels.User) (*dbmodels.User, error)
}

func NewUserRepository

func NewUserRepository(db mysql.SQLExecutor) UserRepository

Jump to

Keyboard shortcuts

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