https://github.com/wagoodman/go-presenter
https://github.com/wagoodman/go-presenter
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/wagoodman/go-presenter
- Owner: wagoodman
- License: apache-2.0
- Created: 2021-10-15T17:36:29.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-15T17:47:58.000Z (about 4 years ago)
- Last Synced: 2025-04-11T00:43:56.474Z (6 months ago)
- Language: Go
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-presenter
This repo houses a single spot for a presenter abstraction:
```go
type Presenter interface {
Present(writer io.Writer) error
}
```I've tended to use this abstraction in multiple projects, but the abstraction itself isn't conceptually coupled to any one project.
This allows for a one-stop-shop to use this abstraction without having to redefine it for each project. Why is this abstraction helpful?
This abstraction enables a few things:
- you can output bytes without the implication that you need a copy of all of the bytes to write at any one point in time
- separates what is being encoded from the encoding invocation (similar to `json.Encoder`)