Documentation
¶
Overview ¶
Package repositories is a package that contains the repository for the microservice
Index ¶
- type DraftMailRepository
- func (r *DraftMailRepository) Create(ctx context.Context, sendMail *models.SendMail) (*models.SendMail, error)
- func (r *DraftMailRepository) Delete(ctx context.Context, id primitive.ObjectID) error
- func (r *DraftMailRepository) GetAll(ctx context.Context, userID primitive.ObjectID, page, limit int64) ([]*models.SendMail, int64, error)
- func (r *DraftMailRepository) GetByID(ctx context.Context, id primitive.ObjectID) (*models.SendMail, error)
- func (r *DraftMailRepository) GetSince(ctx context.Context, userID primitive.ObjectID, since time.Time, ...) ([]*models.SendMail, int64, error)
- func (r *DraftMailRepository) Trash(ctx context.Context, id primitive.ObjectID) error
- func (r *DraftMailRepository) Update(ctx context.Context, id primitive.ObjectID, update bson.M) (*models.SendMail, error)
- type DraftMailRepositoryInterface
- type FolderRepository
- func (r *FolderRepository) Create(ctx context.Context, folder *models.Folder) (*models.Folder, error)
- func (r *FolderRepository) Delete(ctx context.Context, id primitive.ObjectID) error
- func (r *FolderRepository) DeleteByUserID(ctx context.Context, userID primitive.ObjectID) error
- func (r *FolderRepository) GetAll(ctx context.Context, userID primitive.ObjectID) ([]*models.Folder, error)
- func (r *FolderRepository) GetByID(ctx context.Context, id primitive.ObjectID) (*models.Folder, error)
- func (r *FolderRepository) Update(ctx context.Context, id primitive.ObjectID, folder *models.Folder) (*models.Folder, error)
- type FolderRepositoryInterface
- type MailRepository
- func (r *MailRepository) CleanupTrash(ctx context.Context, userID *primitive.ObjectID, days *int) error
- func (r *MailRepository) Create(ctx context.Context, mail *models.Mail) (*models.Mail, error)
- func (r *MailRepository) CreateMany(ctx context.Context, mails []models.Mail) (bool, error)
- func (r *MailRepository) GetAll(ctx context.Context, userID primitive.ObjectID, page, limit int64) ([]*models.Mail, int64, error)
- func (r *MailRepository) GetByID(ctx context.Context, id primitive.ObjectID) (*models.Mail, error)
- func (r *MailRepository) GetSince(ctx context.Context, userID primitive.ObjectID, since time.Time, ...) ([]*models.Mail, int64, error)
- func (r *MailRepository) Update(ctx context.Context, mail *models.Mail) error
- type MailRepositoryInterface
- type SendMailRepository
- func (r *SendMailRepository) Create(ctx context.Context, sendMail *models.SendMail) (*models.SendMail, error)
- func (r *SendMailRepository) Delete(ctx context.Context, id primitive.ObjectID) error
- func (r *SendMailRepository) GetAll(ctx context.Context, userID primitive.ObjectID, page, limit int64) ([]*models.SendMail, int64, error)
- func (r *SendMailRepository) GetByID(ctx context.Context, id primitive.ObjectID) (*models.SendMail, error)
- func (r *SendMailRepository) GetSince(ctx context.Context, userID primitive.ObjectID, since time.Time, ...) ([]*models.SendMail, int64, error)
- func (r *SendMailRepository) Update(ctx context.Context, id primitive.ObjectID, update bson.M) (*models.SendMail, error)
- type SendMailRepositoryInterface
- type TagRepository
- func (r *TagRepository) Create(ctx context.Context, tag *models.Tag) (*models.Tag, error)
- func (r *TagRepository) Delete(ctx context.Context, id primitive.ObjectID) error
- func (r *TagRepository) DeleteByUserID(ctx context.Context, userID primitive.ObjectID) error
- func (r *TagRepository) GetAll(ctx context.Context, userID *primitive.ObjectID) ([]*models.Tag, error)
- func (r *TagRepository) GetByID(ctx context.Context, id primitive.ObjectID) (*models.Tag, error)
- func (r *TagRepository) Update(ctx context.Context, tag *models.Tag) (*models.Tag, error)
- type TagRepositoryInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DraftMailRepository ¶
type DraftMailRepository struct {
// contains filtered or unexported fields
}
DraftMailRepository handles database operations related to draft mails
func (*DraftMailRepository) Create ¶
func (r *DraftMailRepository) Create(ctx context.Context, sendMail *models.SendMail) (*models.SendMail, error)
Create creates a new draft mail
func (*DraftMailRepository) GetAll ¶
func (r *DraftMailRepository) GetAll(ctx context.Context, userID primitive.ObjectID, page, limit int64) ([]*models.SendMail, int64, error)
GetAll retrieves draft mails for a user. If page and limit are >0, returns paginated results and total count. If page or limit <=0, returns all draft mails and total count.
func (*DraftMailRepository) GetByID ¶
func (r *DraftMailRepository) GetByID(ctx context.Context, id primitive.ObjectID) (*models.SendMail, error)
GetByID retrieves a draft mail by its ID
func (*DraftMailRepository) GetSince ¶ added in v0.3.0
func (r *DraftMailRepository) GetSince(ctx context.Context, userID primitive.ObjectID, since time.Time, page, limit int64) ([]*models.SendMail, int64, error)
GetSince retrieves draft mails where updated_at is after the specified time for a specific user. If page and limit are >0, returns paginated results and total count. If page or limit <=0, returns all draft mails and total count.
type DraftMailRepositoryInterface ¶
type DraftMailRepositoryInterface interface {
// GetAll retrieves draft mails for a user. If page and limit are >0, returns paginated results and total count. If page or limit <=0, returns all draft mails and total count.
GetAll(ctx context.Context, userID primitive.ObjectID, page, limit int64) ([]*models.SendMail, int64, error)
GetByID(ctx context.Context, id primitive.ObjectID) (*models.SendMail, error)
Create(ctx context.Context, sendMail *models.SendMail) (*models.SendMail, error)
Update(ctx context.Context, id primitive.ObjectID, update bson.M) (*models.SendMail, error)
Trash(ctx context.Context, id primitive.ObjectID) error
Delete(ctx context.Context, id primitive.ObjectID) error
// GetSince retrieves draft mails where updated_at is after the specified time for a specific user. If page and limit are >0, returns paginated results and total count. If page or limit <=0, returns all draft mails and total count.
GetSince(ctx context.Context, userID primitive.ObjectID, since time.Time, page, limit int64) ([]*models.SendMail, int64, error)
}
DraftMailRepositoryInterface defines the interface for draft mail repository operations
func NewDraftMailRepository ¶
func NewDraftMailRepository(database *mongo.Database) DraftMailRepositoryInterface
NewDraftMailRepository creates a new draft mail repository instance
type FolderRepository ¶
type FolderRepository struct {
// contains filtered or unexported fields
}
FolderRepository handles database operations related to folders
func (*FolderRepository) Create ¶
func (r *FolderRepository) Create(ctx context.Context, folder *models.Folder) (*models.Folder, error)
Create creates a new folder
func (*FolderRepository) DeleteByUserID ¶
DeleteByUserID deletes all folders for a specific user
func (*FolderRepository) GetAll ¶
func (r *FolderRepository) GetAll(ctx context.Context, userID primitive.ObjectID) ([]*models.Folder, error)
GetAll retrieves all folders for a user
type FolderRepositoryInterface ¶
type FolderRepositoryInterface interface {
GetAll(ctx context.Context, userID primitive.ObjectID) ([]*models.Folder, error)
Create(ctx context.Context, folder *models.Folder) (*models.Folder, error)
Update(ctx context.Context, id primitive.ObjectID, folder *models.Folder) (*models.Folder, error)
Delete(ctx context.Context, id primitive.ObjectID) error
DeleteByUserID(ctx context.Context, userID primitive.ObjectID) error
}
FolderRepositoryInterface defines the interface for folder repository operations
func NewFolderRepository ¶
func NewFolderRepository(database *mongo.Database) FolderRepositoryInterface
NewFolderRepository creates a new folder repository instance
type MailRepository ¶
type MailRepository struct {
// contains filtered or unexported fields
}
MailRepository handles database operations related to mails
func (*MailRepository) CleanupTrash ¶
func (r *MailRepository) CleanupTrash(ctx context.Context, userID *primitive.ObjectID, days *int) error
CleanupTrash cleans up trash mails when trashed_at is 30 days or older and trashed is true
func (*MailRepository) CreateMany ¶
CreateMany creates multiple mails
func (*MailRepository) GetAll ¶
func (r *MailRepository) GetAll(ctx context.Context, userID primitive.ObjectID, page, limit int64) ([]*models.Mail, int64, error)
GetAll retrieves mails for a user. If page and limit are >0, returns paginated results and total count. If page or limit <=0, returns all mails and total count.
func (*MailRepository) GetSince ¶ added in v0.3.0
func (r *MailRepository) GetSince(ctx context.Context, userID primitive.ObjectID, since time.Time, page, limit int64) ([]*models.Mail, int64, error)
GetSince retrieves mails where updated_at is after the specified time for a specific user. If page and limit are >0, returns paginated results and total count. If page or limit <=0, returns all mails and total count.
type MailRepositoryInterface ¶
type MailRepositoryInterface interface {
// GetAll retrieves mails for a user. If page and limit are >0, returns paginated results and total count. If page or limit <=0, returns all mails and total count.
GetAll(ctx context.Context, userID primitive.ObjectID, page, limit int64) ([]*models.Mail, int64, error)
GetByID(ctx context.Context, id primitive.ObjectID) (*models.Mail, error)
Create(ctx context.Context, mail *models.Mail) (*models.Mail, error)
CreateMany(ctx context.Context, mails []models.Mail) (bool, error)
// Update updates a mail object
Update(ctx context.Context, mail *models.Mail) error
// CleanupTrash cleans up trash mails
CleanupTrash(ctx context.Context, userID *primitive.ObjectID, days *int) error
// GetSince retrieves mails where updated_at is after the specified time for a specific user. If page and limit are >0, returns paginated results and total count. If page or limit <=0, returns all mails and total count.
GetSince(ctx context.Context, userID primitive.ObjectID, since time.Time, page, limit int64) ([]*models.Mail, int64, error)
}
MailRepositoryInterface defines the interface for mail repository operations
func NewMailRepository ¶
func NewMailRepository(database *mongo.Database) MailRepositoryInterface
NewMailRepository creates a new mail repository instance
type SendMailRepository ¶
type SendMailRepository struct {
// contains filtered or unexported fields
}
SendMailRepository handles database operations related to send mails
func (*SendMailRepository) Create ¶
func (r *SendMailRepository) Create(ctx context.Context, sendMail *models.SendMail) (*models.SendMail, error)
Create creates a new send mail
func (*SendMailRepository) GetAll ¶
func (r *SendMailRepository) GetAll(ctx context.Context, userID primitive.ObjectID, page, limit int64) ([]*models.SendMail, int64, error)
GetAll retrieves send mails for a user. If page and limit are >0, returns paginated results and total count. If page or limit <=0, returns all send mails and total count.
func (*SendMailRepository) GetByID ¶
func (r *SendMailRepository) GetByID(ctx context.Context, id primitive.ObjectID) (*models.SendMail, error)
GetByID retrieves a send mail by its ID
func (*SendMailRepository) GetSince ¶ added in v0.4.0
func (r *SendMailRepository) GetSince(ctx context.Context, userID primitive.ObjectID, since time.Time, page, limit int64) ([]*models.SendMail, int64, error)
GetSince retrieves send mails where updated_at is after the specified time for a specific user. If page and limit are >0, returns paginated results and total count. If page or limit <=0, returns all send mails and total count.
type SendMailRepositoryInterface ¶
type SendMailRepositoryInterface interface {
// GetAll retrieves send mails for a user. If page and limit are >0, returns paginated results and total count. If page or limit <=0, returns all send mails and total count.
GetAll(ctx context.Context, userID primitive.ObjectID, page, limit int64) ([]*models.SendMail, int64, error)
GetByID(ctx context.Context, id primitive.ObjectID) (*models.SendMail, error)
Create(ctx context.Context, sendMail *models.SendMail) (*models.SendMail, error)
Update(ctx context.Context, id primitive.ObjectID, update bson.M) (*models.SendMail, error)
Delete(ctx context.Context, id primitive.ObjectID) error
// GetSince retrieves send mails where updated_at is after the specified time for a specific user. If page and limit are >0, returns paginated results and total count. If page or limit <=0, returns all send mails and total count.
GetSince(ctx context.Context, userID primitive.ObjectID, since time.Time, page, limit int64) ([]*models.SendMail, int64, error)
}
SendMailRepositoryInterface defines the interface for send mail repository operations
func NewSendMailRepository ¶
func NewSendMailRepository(database *mongo.Database) SendMailRepositoryInterface
NewSendMailRepository creates a new send mail repository instance
type TagRepository ¶
type TagRepository struct {
// contains filtered or unexported fields
}
TagRepository handles database operations related to tags
func NewTagRepository ¶
func NewTagRepository(db *mongo.Database) *TagRepository
NewTagRepository creates a new tag repository instance
func (*TagRepository) DeleteByUserID ¶
DeleteByUserID deletes all tags for a specific user
func (*TagRepository) GetAll ¶
func (r *TagRepository) GetAll(ctx context.Context, userID *primitive.ObjectID) ([]*models.Tag, error)
GetAll retrieves all tags with optional user filtering
type TagRepositoryInterface ¶
type TagRepositoryInterface interface {
GetAll(ctx context.Context, userID *primitive.ObjectID) ([]*models.Tag, error)
GetByID(ctx context.Context, id primitive.ObjectID) (*models.Tag, error)
Create(ctx context.Context, tag *models.Tag) (*models.Tag, error)
Update(ctx context.Context, tag *models.Tag) (*models.Tag, error)
Delete(ctx context.Context, id primitive.ObjectID) error
DeleteByUserID(ctx context.Context, userID primitive.ObjectID) error
}
TagRepositoryInterface defines the interface for tag repository operations