repository

package
v0.0.0-...-771bf79 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

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 (CustomDocumentRepository) GetById

func (CustomDocumentRepository) GetByUserId

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 (r *ReadingExtendRepository) GetReadingsByUserId(ctx context.Context, userId primitive.ObjectID, page, limit int64, sortOrder int) ([]models.Reading, error)

func (*ReadingExtendRepository) GetReadingsByUserIdAndReadingStatus

func (r *ReadingExtendRepository) GetReadingsByUserIdAndReadingStatus(
	ctx context.Context,
	userId primitive.ObjectID,
	readingType string,
	page, limit int64,
	sortOrder int) ([]models.Reading, error)

func (*ReadingExtendRepository) GetReadingsByUserIdAndReadingType

func (r *ReadingExtendRepository) GetReadingsByUserIdAndReadingType(
	ctx context.Context,
	userId primitive.ObjectID,
	readingType string,
	sortValue string,
	page, limit int64,
	sortOrder int) ([]models.Reading, error)

func (*ReadingExtendRepository) IsReadingExistsForUser

func (r *ReadingExtendRepository) IsReadingExistsForUser(ctx context.Context, userId, documentId primitive.ObjectID) (bool, error)

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 (r ReadingListRepository) AddReadingsToList(ctx context.Context, userId primitive.ObjectID, readingListId primitive.ObjectID, readingsId []primitive.ObjectID) (*mongo.UpdateResult, error)

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 (ReadingListRepository) RemoveReadingsFromList

func (r ReadingListRepository) RemoveReadingsFromList(ctx context.Context, userId primitive.ObjectID, readingListId primitive.ObjectID, readingsId []primitive.ObjectID) (*mongo.UpdateResult, error)

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 (r *Repository[T]) GetAllSortedPaginated(ctx context.Context, sortFields bson.D, page int64, limit int64) ([]T, error)

func (*Repository[T]) GetByFilter

func (r *Repository[T]) GetByFilter(ctx context.Context, filter interface{}) (*T, error)

func (*Repository[T]) GetByID

func (r *Repository[T]) GetByID(ctx context.Context, id primitive.ObjectID) (*T, error)

func (*Repository[T]) GetManyByFilter

func (r *Repository[T]) GetManyByFilter(ctx context.Context, filter interface{}) ([]T, error)

func (*Repository[T]) GetManyByFilterPaginated

func (r *Repository[T]) GetManyByFilterPaginated(ctx context.Context, filter interface{}, page int64, limit int64) ([]T, error)

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

Jump to

Keyboard shortcuts

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