package httpbinding

import (
	
	
	
	
	
)

// QueryValue is used to encode query key values
type QueryValue struct {
	query  url.Values
	key    string
	append bool
}

// NewQueryValue creates a new QueryValue which enables encoding
// a query value into the given url.Values.
func ( url.Values,  string,  bool) QueryValue {
	return QueryValue{
		query:  ,
		key:    ,
		append: ,
	}
}

func ( QueryValue) ( string) {
	if .append {
		.query.Add(.key, )
	} else {
		.query.Set(.key, )
	}
}

// Blob encodes v as a base64 query string value
func ( QueryValue) ( []byte) {
	 := base64.StdEncoding.EncodeToString()
	.updateKey()
}

// Boolean encodes v as a query string value
func ( QueryValue) ( bool) {
	.updateKey(strconv.FormatBool())
}

// String encodes v as a query string value
func ( QueryValue) ( string) {
	.updateKey()
}

// Byte encodes v as a query string value
func ( QueryValue) ( int8) {
	.Long(int64())
}

// Short encodes v as a query string value
func ( QueryValue) ( int16) {
	.Long(int64())
}

// Integer encodes v as a query string value
func ( QueryValue) ( int32) {
	.Long(int64())
}

// Long encodes v as a query string value
func ( QueryValue) ( int64) {
	.updateKey(strconv.FormatInt(, 10))
}

// Float encodes v as a query string value
func ( QueryValue) ( float32) {
	.float(float64(), 32)
}

// Double encodes v as a query string value
func ( QueryValue) ( float64) {
	.float(, 64)
}

func ( QueryValue) ( float64,  int) {
	switch {
	case math.IsNaN():
		.String(floatNaN)
	case math.IsInf(, 1):
		.String(floatInfinity)
	case math.IsInf(, -1):
		.String(floatNegInfinity)
	default:
		.updateKey(strconv.FormatFloat(, 'f', -1, ))
	}
}

// BigInteger encodes v as a query string value
func ( QueryValue) ( *big.Int) {
	.updateKey(.String())
}

// BigDecimal encodes v as a query string value
func ( QueryValue) ( *big.Float) {
	if ,  := .Int64();  == big.Exact {
		.Long()
		return
	}
	.updateKey(.Text('e', -1))
}