repository

package
v0.0.0-...-521d95a Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRepository

type AuthRepository struct {
	// contains filtered or unexported fields
}

func NewAuthRepository

func NewAuthRepository(db *mongo.Database) *AuthRepository

func (*AuthRepository) CreateUser

func (r *AuthRepository) CreateUser(ctx context.Context, user model.User) error

type Authorization

type Authorization interface {
	CreateUser(ctx context.Context, user model.User) error
}

type Repository

type Repository struct {
	Authorization
	User
	Todo
}

func New

func New(db *mongo.Database) *Repository

type Todo

type Todo interface {
	Create(ctx context.Context, todo model.Todo) error
	FindAll(ctx context.Context, userID primitive.ObjectID) ([]*model.Todo, error)
	Update(ctx context.Context, todoID primitive.ObjectID, userID primitive.ObjectID, options model.TodoUpdateOptions) error
	Delete(ctx context.Context, todoID primitive.ObjectID, userID primitive.ObjectID) error
	FindCompletedTodos(ctx context.Context, userID primitive.ObjectID) ([]*model.Todo, error)
	FindImportantTodos(ctx context.Context, userID primitive.ObjectID) ([]*model.Todo, error)
	FindUncompletedTodos(ctx context.Context, userID primitive.ObjectID) ([]*model.Todo, error)
}

type TodoRepository

type TodoRepository struct {
	// contains filtered or unexported fields
}

func NewTodoRepository

func NewTodoRepository(db *mongo.Database) *TodoRepository

func (*TodoRepository) Create

func (r *TodoRepository) Create(ctx context.Context, todo model.Todo) error

func (*TodoRepository) Delete

func (r *TodoRepository) Delete(ctx context.Context, todoID primitive.ObjectID, userID primitive.ObjectID) error

func (*TodoRepository) FindAll

func (r *TodoRepository) FindAll(ctx context.Context, userID primitive.ObjectID) ([]*model.Todo, error)

func (*TodoRepository) FindCompletedTodos

func (r *TodoRepository) FindCompletedTodos(ctx context.Context, userID primitive.ObjectID) ([]*model.Todo, error)

func (*TodoRepository) FindImportantTodos

func (r *TodoRepository) FindImportantTodos(ctx context.Context, userID primitive.ObjectID) ([]*model.Todo, error)

func (*TodoRepository) FindUncompletedTodos

func (r *TodoRepository) FindUncompletedTodos(ctx context.Context, userID primitive.ObjectID) ([]*model.Todo, error)

func (*TodoRepository) Update

type User

type User interface {
	FindById(ctx context.Context, userID primitive.ObjectID) *mongo.SingleResult
	FindByUsername(ctx context.Context, username string) *mongo.SingleResult
	UpdateUsername(ctx context.Context, userID primitive.ObjectID, newUsername string) error
}

type UserRepository

type UserRepository struct {
	// contains filtered or unexported fields
}

func NewUserRepository

func NewUserRepository(db *mongo.Database) *UserRepository

func (*UserRepository) FindById

func (*UserRepository) FindByUsername

func (r *UserRepository) FindByUsername(ctx context.Context, username string) *mongo.SingleResult

func (*UserRepository) UpdateUsername

func (r *UserRepository) UpdateUsername(ctx context.Context, userID primitive.ObjectID, newUsername string) error

Jump to

Keyboard shortcuts

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