repo

package
v0.0.0-...-ae3da92 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

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.

func (TaskRepositoryImpl) List

func (t TaskRepositoryImpl) List() ([]*types.Task, error)

List lists all tasks in a database.

func (TaskRepositoryImpl) Save

func (t TaskRepositoryImpl) Save(data *types.Task) (*types.Task, error)

Save saves a task into a database.

Jump to

Keyboard shortcuts

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