package httpbinding
import (
)
type QueryValue struct {
query url.Values
key string
append bool
}
func ( url.Values, string, bool) QueryValue {
return QueryValue{
query: ,
key: ,
append: ,
}
}
func ( QueryValue) ( string) {
if .append {
.query.Add(.key, )
} else {
.query.Set(.key, )
}
}
func ( QueryValue) ( []byte) {
:= base64.StdEncoding.EncodeToString()
.updateKey()
}
func ( QueryValue) ( bool) {
.updateKey(strconv.FormatBool())
}
func ( QueryValue) ( string) {
.updateKey()
}
func ( QueryValue) ( int8) {
.Long(int64())
}
func ( QueryValue) ( int16) {
.Long(int64())
}
func ( QueryValue) ( int32) {
.Long(int64())
}
func ( QueryValue) ( int64) {
.updateKey(strconv.FormatInt(, 10))
}
func ( QueryValue) ( float32) {
.float(float64(), 32)
}
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, ))
}
}
func ( QueryValue) ( *big.Int) {
.updateKey(.String())
}
func ( QueryValue) ( *big.Float) {
if , := .Int64(); == big.Exact {
.Long()
return
}
.updateKey(.Text('e', -1))
}