route.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package context
  2. import "github.com/kataras/iris/core/router/macro"
  3. // RouteReadOnly allows decoupled access to the current route
  4. // inside the context.
  5. type RouteReadOnly interface {
  6. // Name returns the route's name.
  7. Name() string
  8. // Method returns the route's method.
  9. Method() string
  10. // Subdomains returns the route's subdomain.
  11. Subdomain() string
  12. // Path returns the route's original registered path.
  13. Path() string
  14. // String returns the form of METHOD, SUBDOMAIN, TMPL PATH.
  15. String() string
  16. // IsOnline returns true if the route is marked as "online" (state).
  17. IsOnline() bool
  18. // StaticPath returns the static part of the original, registered route path.
  19. // if /user/{id} it will return /user
  20. // if /user/{id}/friend/{friendid:int} it will return /user too
  21. // if /assets/{filepath:path} it will return /assets.
  22. StaticPath() string
  23. // ResolvePath returns the formatted path's %v replaced with the args.
  24. ResolvePath(args ...string) string
  25. // Tmpl returns the path template,
  26. // it contains the parsed template
  27. // for the route's path.
  28. // May contain zero named parameters.
  29. //
  30. // Available after the build state, i.e a request handler or Iris Configurator.
  31. Tmpl() macro.Template
  32. // MainHandlerName returns the first registered handler for the route.
  33. MainHandlerName() string
  34. }