April 23, 2021
Tiny abstractions: Function hooks in Go
Function hooks are single method interfaces without the interface. // GetPersonFunc is a func that gets a Person by ID. type GetPersonFunc func(ctx context.Context, personID string) *Person I use them; • when my service code is still young, before any firm abstractions have emerged - see Tiny abstraction example • when I want to plug i...
Read more