Documentation ¶
Index ¶
- type MongoDB
- func (mdb *MongoDB) CreateAccount(username, password string) error
- func (mdb *MongoDB) CreateTask(userID string, taskDetail string) ([]*db.Task, error)
- func (mdb *MongoDB) DeleteTask(userID, taskID string) ([]*db.Task, error)
- func (mdb *MongoDB) Login(username, password string) (*db.User, error)
- func (mdb *MongoDB) Shutdown(ctx context.Context) error
- func (mdb *MongoDB) Tasks(userID string) ([]*db.Task, error)
- func (mdb *MongoDB) TasksWithStatus(userID string, completed bool) ([]*db.Task, error)
- func (mdb *MongoDB) UpdateTask(userID, taskID string, newTaskDetail string, markAsComplete *bool) ([]*db.Task, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoDB ¶
type MongoDB struct {
// contains filtered or unexported fields
}
MongoDB implements webserver.TaskDatabase.
func (*MongoDB) CreateAccount ¶
CreateAccount creates a new user with the provided username and password. An ErrorInvalidRequest will be returned is the username already exists.
func (*MongoDB) CreateTask ¶
CreateTask creates a new task entry for a user.
func (*MongoDB) DeleteTask ¶
DeleteTask removes an existing task from the record of the user that match the provided userID. If no task match the provided taskID, an ErrorInvalidRequest is returned.
func (*MongoDB) Login ¶
Login checks that the provided username and password matches a record in the database and are correct. Returns ErrorInvalidRequest if the password or username does not match any record.
func (*MongoDB) TasksWithStatus ¶
TasksWithStatus returns user tasks that matches the provided filter.