Beispiel #1
0
func constructInput(method reflect.Value, queryValues url.Values) (interface{}, error) {
	inputValueType := method.Type().In(0).Elem()
	inputValue := reflect.New(inputValueType).Interface()
	isEC2 := methodIsEC2(method)
	queryutil.Decode(queryValues, inputValue, isEC2)
	return inputValue, nil
}
Beispiel #2
0
					Time:    aws.Time(time.Now().UTC().Round(time.Second)),
					ScalarArray: []*string{
						aws.String("one"),
						aws.String("two"),
					},
				},
			},
		}

		encoded := make(url.Values)

		err := queryutil.Encode(encoded, originalData, false)
		Expect(err).NotTo(HaveOccurred())

		decoded := dataObject{}
		err = queryutil.Decode(encoded, &decoded, false)
		Expect(err).NotTo(HaveOccurred())
		Expect(decoded).To(Equal(originalData))
	})

	It("it should use nil values for missing data", func() {
		originalData := dataObject{
			SomeString: "some string",
			Bytes:      []byte("some bytes"),
			StructArray: []*Inner{
				&Inner{
					Bool: aws.Bool(true),
				},
			},
			BasicMap: map[string]*string{
				"A": aws.String("B"),