Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

18 linhas
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. }