This commit is contained in:
Erik Winter 2024-08-20 08:34:11 +02:00
parent 94a85d2117
commit a1e72c0400
5 changed files with 38 additions and 6 deletions

5
go.mod
View File

@ -2,4 +2,7 @@ module code.ewintr.nl/planner
go 1.21.5
require github.com/google/go-cmp v0.6.0 // indirect
require (
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/uuid v1.6.0 // indirect
)

2
go.sum
View File

@ -1,2 +1,4 @@
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=

25
planner/planner.go Normal file
View File

@ -0,0 +1,25 @@
package planner
import (
"time"
"github.com/google/uuid"
)
type Syncable interface {
LastUpdated() time.Time
}
type Task struct {
ID string
description string
updated time.Time
}
func NewTask(description string) Task {
return Task{
ID: uuid.New(),
description: description,
updated: time.Now(),
}
}

View File

@ -1,16 +1,18 @@
package service
package storage
import "code.ewintr.nl/planner/planner"
type Memory struct {
projects map[string]Project
projects map[string]planner.Task
}
func NewMemory() *Memory {
return &Memory{
projects: make(map[string]Project),
projects: make(map[string]planner.Task),
}
}
func (m *Memory) StoreProject(project Project) error {
func (m *Memory) StoreProject(project planner.Task) error {
m.projects[project.ID] = project
return nil

View File

@ -1,4 +1,4 @@
package service_test
package storage_test
import (
"testing"