defining_depenency_injection

package
v0.0.0-...-de70ca6 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SavePerson

func SavePerson(person *Person, saver Saver) error

SavePerson will validate and persist the supplied person

Types

type Person

type Person struct {
	Name  string
	Phone string
}

Person data object

func LoadPerson

func LoadPerson(ID int, decodePerson func(data []byte) *Person) (*Person, error)

LoadPerson will load the requested person by ID. Errors include: invalid ID, missing person and failure to load or decode.

type Saver

type Saver interface {
	Save(data []byte) error
}

Saver persists the supplied bytes

Jump to

Keyboard shortcuts

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