base.go 362 B

12345678910111213141516171819202122
  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. }