Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

18 rindas
637 B

  1. // Copyright 2016 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package uritemplates
  5. // Expand parses then expands a URI template with a set of values to produce
  6. // the resultant URI. Two forms of the result are returned: one with all the
  7. // elements escaped, and one with the elements unescaped.
  8. func Expand(path string, values map[string]string) (escaped, unescaped string, err error) {
  9. template, err := parse(path)
  10. if err != nil {
  11. return "", "", err
  12. }
  13. escaped, unescaped = template.Expand(values)
  14. return escaped, unescaped, nil
  15. }