todos

package
v0.0.0-...-515d911 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Create

func Create(w http.ResponseWriter, r *http.Request)

Create calls the Insert func

func Delete

func Delete(w http.ResponseWriter, r *http.Request)

Delete remove a ToDo by ID

func DeleteById

func DeleteById(id string) (*mongo.DeleteResult, error)

func Insert

func Insert(item Todo) error

func Read

func Read(w http.ResponseWriter, r *http.Request)

Read calls the GetAll func

func Routes

func Routes(r chi.Router)

func ToggleDone

func ToggleDone(w http.ResponseWriter, r *http.Request)

Update calls the UpdateById func

func Update

func Update(w http.ResponseWriter, r *http.Request)

Update calls the UpdateById func

func UpdateById

func UpdateById(id string, todo *Todo) (*mongo.UpdateResult, error)

Types

type Todo

type Todo struct {
	ID   string `json:"id"`
	Task string `json:"task"`
	Done bool   `json:"done"`
}

func GetAll

func GetAll() ([]*Todo, error)

func GetById

func GetById(id string) (*Todo, error)

type TodosHandler

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

Jump to

Keyboard shortcuts

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