本文整理匯總了Golang中github.com/youtube/vitess/go/vt/proto/query.BindVariable.ValueFloat方法的典型用法代碼示例。如果您正苦於以下問題:Golang BindVariable.ValueFloat方法的具體用法?Golang BindVariable.ValueFloat怎麽用?Golang BindVariable.ValueFloat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/youtube/vitess/go/vt/proto/query.BindVariable
的用法示例。
在下文中一共展示了BindVariable.ValueFloat方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: BindVariablesToProto3
//.........這裏部分代碼省略.........
for i, lv := range v {
listArg[i] = uint64(lv.(uint))
}
bv.ValueUintList = listArg
case uint16:
bv.Type = pb.BindVariable_TYPE_UINT_LIST
listArg := make([]uint64, len(v))
for i, lv := range v {
listArg[i] = uint64(lv.(uint16))
}
bv.ValueUintList = listArg
case uint32:
bv.Type = pb.BindVariable_TYPE_UINT_LIST
listArg := make([]uint64, len(v))
for i, lv := range v {
listArg[i] = uint64(lv.(uint32))
}
bv.ValueUintList = listArg
case uint64:
bv.Type = pb.BindVariable_TYPE_UINT_LIST
listArg := make([]uint64, len(v))
for i, lv := range v {
listArg[i] = lv.(uint64)
}
bv.ValueUintList = listArg
// float32, float64 are TYPE_FLOAT_LIST
case float32:
bv.Type = pb.BindVariable_TYPE_FLOAT_LIST
listArg := make([]float64, len(v))
for i, lv := range v {
listArg[i] = float64(lv.(float32))
}
bv.ValueFloatList = listArg
case float64:
bv.Type = pb.BindVariable_TYPE_FLOAT_LIST
listArg := make([]float64, len(v))
for i, lv := range v {
listArg[i] = lv.(float64)
}
bv.ValueFloatList = listArg
case nil:
// do nothing
default:
return nil, fmt.Errorf("unexpected type %T for variable %q", valt, k)
}
case string:
bv.Type = pb.BindVariable_TYPE_BYTES
bv.ValueBytes = []byte(v)
case []string:
bv.Type = pb.BindVariable_TYPE_BYTES_LIST
listArg := make([][]byte, len(v))
for i, lv := range v {
listArg[i] = []byte(lv)
}
bv.ValueBytesList = listArg
case []byte:
bv.Type = pb.BindVariable_TYPE_BYTES
bv.ValueBytes = v
case [][]byte:
bv.Type = pb.BindVariable_TYPE_BYTES_LIST
listArg := make([][]byte, len(v))
for i, lv := range v {
listArg[i] = lv
}
bv.ValueBytesList = listArg
示例2: BoundQueryToProto3
//.........這裏部分代碼省略.........
for i, lv := range v {
listArg[i] = uint64(lv.(uint))
}
bv.ValueUintList = listArg
case uint16:
bv.Type = pb.BindVariable_TYPE_UINT_LIST
listArg := make([]uint64, len(v))
for i, lv := range v {
listArg[i] = uint64(lv.(uint16))
}
bv.ValueUintList = listArg
case uint32:
bv.Type = pb.BindVariable_TYPE_UINT_LIST
listArg := make([]uint64, len(v))
for i, lv := range v {
listArg[i] = uint64(lv.(uint32))
}
bv.ValueUintList = listArg
case uint64:
bv.Type = pb.BindVariable_TYPE_UINT_LIST
listArg := make([]uint64, len(v))
for i, lv := range v {
listArg[i] = lv.(uint64)
}
bv.ValueUintList = listArg
// float32, float64 are TYPE_FLOAT_LIST
case float32:
bv.Type = pb.BindVariable_TYPE_FLOAT_LIST
listArg := make([]float64, len(v))
for i, lv := range v {
listArg[i] = float64(lv.(float32))
}
bv.ValueFloatList = listArg
case float64:
bv.Type = pb.BindVariable_TYPE_FLOAT_LIST
listArg := make([]float64, len(v))
for i, lv := range v {
listArg[i] = lv.(float64)
}
bv.ValueFloatList = listArg
}
case string:
bv.Type = pb.BindVariable_TYPE_BYTES
bv.ValueBytes = []byte(v)
case []string:
bv.Type = pb.BindVariable_TYPE_BYTES_LIST
listArg := make([][]byte, len(v))
for i, lv := range v {
listArg[i] = []byte(lv)
}
bv.ValueBytesList = listArg
case []byte:
bv.Type = pb.BindVariable_TYPE_BYTES
bv.ValueBytes = v
case [][]byte:
bv.Type = pb.BindVariable_TYPE_BYTES_LIST
listArg := make([][]byte, len(v))
for i, lv := range v {
listArg[i] = lv
}
bv.ValueBytesList = listArg
case int:
bv.Type = pb.BindVariable_TYPE_INT
bv.ValueInt = int64(v)
case int16: