chart.go 519 B

12345678910111213141516171819202122
  1. package forms
  2. import "net/url"
  3. // ChartForm is the base type for CRUD operations on charts
  4. type ChartForm struct {
  5. RepoURL string
  6. Name string `json:"name"`
  7. Version string `json:"version"`
  8. }
  9. // PopulateRepoURLFromQueryParams populates the repo url in the ChartForm using the passed
  10. // url.Values (the parsed query params)
  11. func (cf *ChartForm) PopulateRepoURLFromQueryParams(
  12. vals url.Values,
  13. ) error {
  14. if repoURL, ok := vals["repo_url"]; ok && len(repoURL) == 1 {
  15. cf.RepoURL = repoURL[0]
  16. }
  17. return nil
  18. }