Documentation ¶
Index ¶
Constants ¶
View Source
const ( // TaskCollection is a name of collection for storing tasks. TaskCollection string = "tasks" //LimitDefault specifies default limit for FindAll operation LimitDefault int = 1000 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TaskRepository ¶
type TaskRepository interface { // Save saves task to a database. Save(t *types.Task) (*types.Task, error) // List returns all tasks. List() ([]*types.Task, error) // Delete deletes task by id. Delete(id string) error // FindByID returns task with the given id. FindByID(id string) (*types.Task, error) }
TaskRepository is a repository to access tasks.
func NewTaskRepository ¶
func NewTaskRepository(mongoURL string) TaskRepository
NewTaskRepository creates new task repository.
type TaskRepositoryImpl ¶
type TaskRepositoryImpl struct {
// contains filtered or unexported fields
}
TaskRepositoryImpl is an implementation of task repository.
func (TaskRepositoryImpl) Delete ¶
func (t TaskRepositoryImpl) Delete(id string) error
Delete deletes task with the given id from the database.
func (TaskRepositoryImpl) FindByID ¶
func (t TaskRepositoryImpl) FindByID(id string) (*types.Task, error)
FindByID returns task with the given ID.
Click to show internal directories.
Click to hide internal directories.