gitea源码

router_combo.go 866B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2024 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package web
  4. // Combo represents a tiny group routes with same pattern
  5. type Combo struct {
  6. r *Router
  7. pattern string
  8. h []any
  9. }
  10. // Get delegates Get method
  11. func (c *Combo) Get(h ...any) *Combo {
  12. c.r.Get(c.pattern, append(c.h, h...)...)
  13. return c
  14. }
  15. // Post delegates Post method
  16. func (c *Combo) Post(h ...any) *Combo {
  17. c.r.Post(c.pattern, append(c.h, h...)...)
  18. return c
  19. }
  20. // Delete delegates Delete method
  21. func (c *Combo) Delete(h ...any) *Combo {
  22. c.r.Delete(c.pattern, append(c.h, h...)...)
  23. return c
  24. }
  25. // Put delegates Put method
  26. func (c *Combo) Put(h ...any) *Combo {
  27. c.r.Put(c.pattern, append(c.h, h...)...)
  28. return c
  29. }
  30. // Patch delegates Patch method
  31. func (c *Combo) Patch(h ...any) *Combo {
  32. c.r.Patch(c.pattern, append(c.h, h...)...)
  33. return c
  34. }