github.com/timstclair/heapster@v0.20.0-alpha1/Godeps/_workspace/src/google.golang.org/api/gensupport/params.go (about)

     1  // Copyright 2015 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  
     5  package gensupport
     6  
     7  import "net/url"
     8  
     9  // URLParams is a simplified replacement for url.Values
    10  // that safely builds up URL parameters for encoding.
    11  type URLParams map[string][]string
    12  
    13  // Set sets the key to value.
    14  // It replaces any existing values.
    15  func (u URLParams) Set(key, value string) {
    16  	u[key] = []string{value}
    17  }
    18  
    19  // SetMulti sets the key to an array of values.
    20  // It replaces any existing values.
    21  // Note that values must not be modified after calling SetMulti
    22  // so the caller is responsible for making a copy if necessary.
    23  func (u URLParams) SetMulti(key string, values []string) {
    24  	u[key] = values
    25  }
    26  
    27  // Encode encodes the values into ``URL encoded'' form
    28  // ("bar=baz&foo=quux") sorted by key.
    29  func (u URLParams) Encode() string {
    30  	return url.Values(u).Encode()
    31  }