This repository was archived by the owner on Dec 27, 2022. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork15
golang and decorators / decorator patterns
NotificationsYou must be signed in to change notification settings
alex-leonhardt/go-decorator-pattern
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
a playground for me (and maybe helpful for others?) to train the brain understand the decorator pattern better
- a basic function decorator, seeexample1
- a basic timing decorator (how long does func X take?), seeexample2
- decorating a method (think OOP), seeexample3
- another method decorator, but using a Func type, useful when the func signature is rather long, seeexample4
- method decorator that takes argumentsexample5
- return the result from the decorated function, instead of printing itexample6
- a logging decorator, seeexample7
- a nested decorator example, seeexample8
- passing data to a http handler is a little weird (to me), but a fully working example is here:go-web-random
- let's play with a interfaceexample9
pull requests are welcomed
About
golang and decorators / decorator patterns
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.