diff --git a/go-training.slide b/go-training.slide index 5ba7511..91346f2 100644 --- a/go-training.slide +++ b/go-training.slide @@ -931,7 +931,7 @@ Tasks: Remove(key string) error } -TIP: Create a constructor function ans let your IDE do the magic +TIP: Create a constructor function and let your IDE do the magic TIP: Use a map as in-memory datastore Peek: examples/interfaces diff --git a/solutions/interfaces/interfaces.go b/solutions/interfaces/interfaces.go index 33fa875..5818716 100644 --- a/solutions/interfaces/interfaces.go +++ b/solutions/interfaces/interfaces.go @@ -5,7 +5,7 @@ type Patient struct { Name string } -type Datastorer interface { +type DataStorer interface { Put(key string, patient any) error Get(key string) (any, bool, error) Remove(key string) error @@ -15,7 +15,7 @@ type inMemoryPatientDatastore struct { data map[string]Patient } -func New() Datastorer { +func New() DataStorer { return &inMemoryPatientDatastore{ data: map[string]Patient{}, }