todos

package
v0.0.0-...-a6a62f5 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: CC-BY-SA-4.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTodoNotFound = errors.New("todo with given UUID does not exist")

Functions

func NewRouter

func NewRouter(repository *Repository) *http.ServeMux

func ResponseErrorBytes

func ResponseErrorBytes(httpCode int) []byte

Types

type API

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

type CreateTodoRequest

type CreateTodoRequest struct {
	Description string `json:"description" binding:"required"`
}

type Repository

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

func NewRepository

func NewRepository() *Repository

type Response

type Response struct {
	Data  map[string]any `json:"data,omitempty"`
	Error string         `json:"error,omitempty"`
}

type Todo

type Todo struct {
	ID          uuid.UUID  `json:"id,omitempty"`
	Description string     `json:"description,omitempty"`
	CompletedAt *time.Time `json:"completed_at,omitempty"`
	CreatedAt   time.Time  `json:"created_at,omitempty"`
	UpdatedAt   *time.Time `json:"updated_at,omitempty"`
}

type UpdateTodoRequest

type UpdateTodoRequest struct {
	Description string     `json:"description" binding:"required"`
	CompletedAt *time.Time `json:"completed_at"`
}

Jump to

Keyboard shortcuts

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