tasks

package
v0.0.0-...-59e8772 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskStatusPending = "pending"
	TaskStatusDone    = "done"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemoryTasksDB

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

func NewInMemoryTasksDB

func NewInMemoryTasksDB() *InMemoryTasksDB

func (*InMemoryTasksDB) AddTask

func (db *InMemoryTasksDB) AddTask(task Task) error

func (*InMemoryTasksDB) DeleteTask

func (db *InMemoryTasksDB) DeleteTask(id string) error

func (*InMemoryTasksDB) GetTask

func (db *InMemoryTasksDB) GetTask(taskID string) (Task, bool)

func (*InMemoryTasksDB) GetTasks

func (db *InMemoryTasksDB) GetTasks(ownerID string) ([]Task, error)

func (*InMemoryTasksDB) UpdateTask

func (db *InMemoryTasksDB) UpdateTask(task Task) error

type Task

type Task struct {
	ID          string
	OwnerID     string
	Title       string
	Description string
	Status      string
	DeletedAt   time.Time
	DeletedBy   string
}

func DeserializeTask

func DeserializeTask(input []byte) (Task, error)

type TaskDeletionResponse

type TaskDeletionResponse struct {
	Method string `json:"method"`
	Url    string `json:"url"`
}

type TaskResponse

type TaskResponse struct {
	ID          string `json:"id"`
	OwnerID     string `json:"ownerId"`
	Title       string `json:"title"`
	Description string `json:"description"`
	Status      string `json:"status"`

	// Fields that will not be serialized as json
	DeletedAt time.Time
	DeletedBy string
}

func NewTaskResponse

func NewTaskResponse(task Task) TaskResponse

type TasksDataSource

type TasksDataSource interface {
	GetTasks(ownerId string) ([]Task, error)
	GetTask(id string) (Task, bool)
	AddTask(task Task) error
	DeleteTask(id string) error
	UpdateTask(task Task) error
}

type TasksHandler

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

func NewTasksHandler

func NewTasksHandler(ds TasksDataSource) *TasksHandler

func (*TasksHandler) AddTask

func (h *TasksHandler) AddTask(c *gin.Context) error

func (*TasksHandler) DeleteTask

func (h *TasksHandler) DeleteTask(c *gin.Context) error

func (*TasksHandler) GetTasks

func (h *TasksHandler) GetTasks(c *gin.Context) error

func (*TasksHandler) UndoDeletion

func (h *TasksHandler) UndoDeletion(c *gin.Context) error

Jump to

Keyboard shortcuts

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