Documentation ¶
Index ¶
- type CustomDocumentRepository
- func (r CustomDocumentRepository) Create(ctx context.Context, userId primitive.ObjectID, ...) error
- func (r CustomDocumentRepository) Delete(ctx context.Context, userId primitive.ObjectID, ...) (*mongo.UpdateResult, error)
- func (r CustomDocumentRepository) GetById(ctx context.Context, userId primitive.ObjectID, ...) (*models.CustomDocument, error)
- func (r CustomDocumentRepository) GetByUserId(ctx context.Context, userId primitive.ObjectID) ([]models.CustomDocument, error)
- func (r CustomDocumentRepository) Update(ctx context.Context, userId primitive.ObjectID, ...) (*mongo.UpdateResult, error)
- type ReadingExtendRepository
- func (r *ReadingExtendRepository) GetReadingsByUserId(ctx context.Context, userId primitive.ObjectID, page, limit int64, ...) ([]models.Reading, error)
- func (r *ReadingExtendRepository) GetReadingsByUserIdAndReadingStatus(ctx context.Context, userId primitive.ObjectID, readingType string, ...) ([]models.Reading, error)
- func (r *ReadingExtendRepository) GetReadingsByUserIdAndReadingType(ctx context.Context, userId primitive.ObjectID, readingType string, ...) ([]models.Reading, error)
- func (r *ReadingExtendRepository) IsReadingExistsForUser(ctx context.Context, userId, documentId primitive.ObjectID) (bool, error)
- func (r *ReadingExtendRepository) UpdateRecord(ctx context.Context, id primitive.ObjectID, userId primitive.ObjectID, ...) (*mongo.UpdateResult, error)
- func (r *ReadingExtendRepository) UpdateRecordProperties(ctx context.Context, readingId primitive.ObjectID, recordId primitive.ObjectID, ...) (*mongo.UpdateResult, error)
- func (r *ReadingExtendRepository) UpdateWithFilter(ctx context.Context, id primitive.ObjectID, update interface{}, ...) (*mongo.UpdateResult, error)
- type ReadingListRepository
- func (r ReadingListRepository) AddReadingsToList(ctx context.Context, userId primitive.ObjectID, ...) (*mongo.UpdateResult, error)
- func (r ReadingListRepository) CreateReadingList(ctx context.Context, userId primitive.ObjectID, ...) error
- func (r ReadingListRepository) DeleteReadingList(ctx context.Context, userId primitive.ObjectID, ...) (*mongo.UpdateResult, error)
- func (r ReadingListRepository) GetByUserId(ctx context.Context, userId primitive.ObjectID) ([]models.ReadingsList, error)
- func (r ReadingListRepository) RemoveReadingsFromList(ctx context.Context, userId primitive.ObjectID, ...) (*mongo.UpdateResult, error)
- func (r ReadingListRepository) UpdateReadingList(ctx context.Context, userId primitive.ObjectID, ...) (*mongo.UpdateResult, error)
- type Repository
- func (r *Repository[T]) Create(ctx context.Context, document *T) (*mongo.InsertOneResult, error)
- func (r *Repository[T]) DeleteById(ctx context.Context, id primitive.ObjectID) (*mongo.DeleteResult, error)
- func (r *Repository[T]) GetAllSortedPaginated(ctx context.Context, sortFields bson.D, page int64, limit int64) ([]T, error)
- func (r *Repository[T]) GetByFilter(ctx context.Context, filter interface{}) (*T, error)
- func (r *Repository[T]) GetByID(ctx context.Context, id primitive.ObjectID) (*T, error)
- func (r *Repository[T]) GetManyByFilter(ctx context.Context, filter interface{}) ([]T, error)
- func (r *Repository[T]) GetManyByFilterPaginated(ctx context.Context, filter interface{}, page int64, limit int64) ([]T, error)
- func (r *Repository[T]) Update(ctx context.Context, id primitive.ObjectID, update interface{}) (*mongo.UpdateResult, error)
- type UserExtendRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CustomDocumentRepository ¶
type CustomDocumentRepository struct {
// contains filtered or unexported fields
}
func NewCustomDocumentRepository ¶
func NewCustomDocumentRepository(userCollection mongo.Collection, userRepository Repository[models.User]) *CustomDocumentRepository
func (CustomDocumentRepository) Create ¶
func (r CustomDocumentRepository) Create(ctx context.Context, userId primitive.ObjectID, customDocument models.CustomDocument) error
func (CustomDocumentRepository) Delete ¶
func (r CustomDocumentRepository) Delete(ctx context.Context, userId primitive.ObjectID, customDocumentId primitive.ObjectID) (*mongo.UpdateResult, error)
func (CustomDocumentRepository) GetById ¶
func (r CustomDocumentRepository) GetById(ctx context.Context, userId primitive.ObjectID, customDocumentId primitive.ObjectID) (*models.CustomDocument, error)
func (CustomDocumentRepository) GetByUserId ¶
func (r CustomDocumentRepository) GetByUserId(ctx context.Context, userId primitive.ObjectID) ([]models.CustomDocument, error)
func (CustomDocumentRepository) Update ¶
func (r CustomDocumentRepository) Update(ctx context.Context, userId primitive.ObjectID, customDocumentId primitive.ObjectID, customDocumentInsertDTO dtos.CustomDocumentInsertDTO) (*mongo.UpdateResult, error)
type ReadingExtendRepository ¶
type ReadingExtendRepository struct {
// contains filtered or unexported fields
}
func NewReadingExtendRepository ¶
func NewReadingExtendRepository(collection mongo.Collection) *ReadingExtendRepository
func (*ReadingExtendRepository) GetReadingsByUserId ¶
func (*ReadingExtendRepository) GetReadingsByUserIdAndReadingStatus ¶
func (*ReadingExtendRepository) GetReadingsByUserIdAndReadingType ¶
func (*ReadingExtendRepository) IsReadingExistsForUser ¶
func (*ReadingExtendRepository) UpdateRecord ¶
func (r *ReadingExtendRepository) UpdateRecord(ctx context.Context, id primitive.ObjectID, userId primitive.ObjectID, update interface{}) (*mongo.UpdateResult, error)
func (*ReadingExtendRepository) UpdateRecordProperties ¶
func (r *ReadingExtendRepository) UpdateRecordProperties(ctx context.Context, readingId primitive.ObjectID, recordId primitive.ObjectID, recordUpdateDTO dtos.ReadingRecordInsertDTO) (*mongo.UpdateResult, error)
func (*ReadingExtendRepository) UpdateWithFilter ¶
func (r *ReadingExtendRepository) UpdateWithFilter(ctx context.Context, id primitive.ObjectID, update interface{}, arrayFilter interface{}) (*mongo.UpdateResult, error)
type ReadingListRepository ¶
type ReadingListRepository struct {
// contains filtered or unexported fields
}
func NewReadingListRepository ¶
func NewReadingListRepository(userCollection mongo.Collection, userRepository Repository[models.User]) *ReadingListRepository
func (ReadingListRepository) AddReadingsToList ¶
func (ReadingListRepository) CreateReadingList ¶
func (r ReadingListRepository) CreateReadingList(ctx context.Context, userId primitive.ObjectID, readingList models.ReadingsList) error
func (ReadingListRepository) DeleteReadingList ¶
func (r ReadingListRepository) DeleteReadingList(ctx context.Context, userId primitive.ObjectID, readingListId primitive.ObjectID) (*mongo.UpdateResult, error)
func (ReadingListRepository) GetByUserId ¶
func (r ReadingListRepository) GetByUserId(ctx context.Context, userId primitive.ObjectID) ([]models.ReadingsList, error)
func (ReadingListRepository) RemoveReadingsFromList ¶
func (ReadingListRepository) UpdateReadingList ¶
func (r ReadingListRepository) UpdateReadingList(ctx context.Context, userId primitive.ObjectID, readingListId primitive.ObjectID, insertDTO dtos.ReadingListInsertDTO) (*mongo.UpdateResult, error)
type Repository ¶
type Repository[T any] struct { // contains filtered or unexported fields }
func NewRepository ¶
func NewRepository[T any](collection *mongo.Collection) *Repository[T]
func (*Repository[T]) Create ¶
func (r *Repository[T]) Create(ctx context.Context, document *T) (*mongo.InsertOneResult, error)
func (*Repository[T]) DeleteById ¶
func (r *Repository[T]) DeleteById(ctx context.Context, id primitive.ObjectID) (*mongo.DeleteResult, error)
func (*Repository[T]) GetAllSortedPaginated ¶
func (*Repository[T]) GetByFilter ¶
func (r *Repository[T]) GetByFilter(ctx context.Context, filter interface{}) (*T, error)
func (*Repository[T]) GetManyByFilter ¶
func (r *Repository[T]) GetManyByFilter(ctx context.Context, filter interface{}) ([]T, error)
func (*Repository[T]) GetManyByFilterPaginated ¶
func (*Repository[T]) Update ¶
func (r *Repository[T]) Update(ctx context.Context, id primitive.ObjectID, update interface{}) (*mongo.UpdateResult, error)
type UserExtendRepository ¶
type UserExtendRepository interface { GetByEmail(ctx context.Context, email string) (*models.User, error) GetByUsername(ctx context.Context, username string) (*models.User, error) UpdateLastLogin(ctx context.Context, userId primitive.ObjectID) error }
func NewUserRepository ¶
func NewUserRepository(collection *mongo.Collection) UserExtendRepository
Click to show internal directories.
Click to hide internal directories.