Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
Update REAMDE with list of examples
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-leonhardt committed Oct 9, 2017
1 parent dd08b66 commit 80a0815
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@

a playground for me (and maybe helpful for others?) to train the brain understand the decorator pattern better

- a basic function decorator, see [example1](example1/)
- a basic timing decorator (how long does func X take?), see [example2](example2/)
- decorating a method (think OOP), see [example3](example3/)
- another method decorator, but using a Func type, useful when the func signature is rather long, see [example4](example4/)
- method decorator that takes arguments [example5](example5/)
- return the result from the decorated function, instead of printing it [example6](example6/)
- a logging decorator, see [example7][example7/])

## contribute

pull requests are welcomed

## todo

- a logger decorator
- using a struct instead of plain functions
- how does this all work when it's a interface
- pass data to http handlefunc
Expand Down
2 changes: 1 addition & 1 deletion example7/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
let's look at how we'd use the decorator pattern for logging things...

the example is basic, but you see
- a custmo logger
- a custom logger
- a struct with a string
- a method to that struct that returns a "prefixed string" (and delays returning by 5s)
- a decorator that uses the custom logger to log the start... and end... of when the method starts and returns
Expand Down

0 comments on commit 80a0815

Please sign in to comment.