Guest User

Untitled

a guest
May 23rd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. package callcount
  2.  
  3. import (
  4. "context"
  5. "fmt"
  6.  
  7. "github.com/fnproject/fn/api/models"
  8. )
  9.  
  10. func (c *CallCount) BeforeCall(ctx context.Context, call *models.Call) error {
  11. if _, ok := callCountMap[call.AppID]; !ok {
  12. callCountMap[call.AppID] = 0
  13. }
  14.  
  15. return nil
  16. }
  17.  
  18. func (c *CallCount) AfterCall(ctx context.Context, call *models.Call) error {
  19. callCountMap[call.AppID]++
  20. fmt.Printf("Call number: %d\n", callCountMap[call.AppID])
  21. return nil
  22. }
Add Comment
Please, Sign In to add comment