base.go 496 B

123456789101112131415161718192021222324252627282930
  1. package param
  2. import (
  3. "context"
  4. "net/url"
  5. )
  6. func GetQuery(c context.Context) url.Values {
  7. query := c.Value("query")
  8. if _, ok := query.(url.Values); ok {
  9. return query.(url.Values)
  10. }
  11. return url.Values{}
  12. }
  13. func GetFromPath(c context.Context) string {
  14. path := c.Value("from_path")
  15. if _, ok := path.(string); ok {
  16. return path.(string)
  17. }
  18. return ""
  19. }
  20. func GetUri(c context.Context) string {
  21. uri := c.Value("uri")
  22. if _, ok := uri.(string); ok {
  23. return uri.(string)
  24. }
  25. return ""
  26. }