mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Can: - move between todo items - toggle checked/unchecked state Cannot: - persiste changes to file - add items - delete items
30 lines
333 B
Go
30 lines
333 B
Go
package todo
|
|
|
|
import(
|
|
"time"
|
|
)
|
|
|
|
type Item struct {
|
|
Checked bool
|
|
Index int
|
|
Text string
|
|
|
|
createdAt time.Time
|
|
updatedAt time.Time
|
|
}
|
|
|
|
func (item *Item) CheckMark() string {
|
|
if item.Checked {
|
|
return "x"
|
|
} else {
|
|
return " "
|
|
}
|
|
}
|
|
|
|
func (item *Item) Toggle() {
|
|
item.Checked = !item.Checked
|
|
item.updatedAt = time.Now()
|
|
}
|
|
|
|
|