task

package
v0.0.0-...-5983c14 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("task not found")
)

Functions

This section is empty.

Types

type CreateTask

type CreateTask struct {
	Description string
}

type Handler

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

func NewHandler

func NewHandler(service Service) *Handler

func (*Handler) DeleteTasksId

func (h *Handler) DeleteTasksId(w http.ResponseWriter, r *http.Request, id int)

DeleteTasksId handles "DELETE /tasks/{id}".

For simplicity, we don't use user in the task domain, but we do use them in other domains.

func (*Handler) GetTasks

func (h *Handler) GetTasks(w http.ResponseWriter, r *http.Request, params timetrackapi.GetTasksParams)

GetTasks handles "GET /tasks/".

For simplicity, we don't use user in the task domain, but we do use them in other domains.

func (*Handler) GetTasksId

func (h *Handler) GetTasksId(w http.ResponseWriter, r *http.Request, id int)

GetTasksId handles "GET /tasks/{id}".

For simplicity, we don't use user in the task domain, but we do use them in other domains.

func (*Handler) PatchTasksId

func (h *Handler) PatchTasksId(w http.ResponseWriter, r *http.Request, id int)

PatchTasksId handles "PATCH /tasks/{id}".

For simplicity, we don't use user in the task domain, but we do use them in other domains.

func (*Handler) PostTasks

func (h *Handler) PostTasks(w http.ResponseWriter, r *http.Request)

PostTasks handles "POST /tasks/".

For simplicity, we don't use user in the task domain, but we do use them in other domains.

type Service

type Service interface {
	Create(ctx context.Context, create *CreateTask) (*Task, error)
	Get(ctx context.Context, id int) (*Task, error)
	List(ctx context.Context, offset, limit int) ([]Task, error)
	Update(ctx context.Context, id int, update *UpdateTask) (*Task, error)
	Delete(ctx context.Context, id int) (*Task, error)
}

type ServiceImpl

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

func NewServiceImpl

func NewServiceImpl(db database.DB) *ServiceImpl

func (*ServiceImpl) Create

func (s *ServiceImpl) Create(ctx context.Context, create *CreateTask) (*Task, error)

func (*ServiceImpl) Delete

func (s *ServiceImpl) Delete(ctx context.Context, id int) (*Task, error)

func (*ServiceImpl) Get

func (s *ServiceImpl) Get(ctx context.Context, id int) (*Task, error)

func (*ServiceImpl) List

func (s *ServiceImpl) List(ctx context.Context, offset, limit int) ([]Task, error)

func (*ServiceImpl) Update

func (s *ServiceImpl) Update(ctx context.Context, id int, update *UpdateTask) (*Task, error)

type Task

type Task struct {
	ID          int
	Description string
}

type UpdateTask

type UpdateTask struct {
	Description *string
}

Jump to

Keyboard shortcuts

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