当前位置: 首页>>代码示例>>Golang>>正文


Golang BindVariable.ValueFloat方法代码示例

本文整理汇总了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
开发者ID:bayannur,项目名称:vitess,代码行数:67,代码来源:proto3.go

示例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:
开发者ID:pranjal5215,项目名称:vitess,代码行数:67,代码来源:proto3.go


注:本文中的github.com/youtube/vitess/go/vt/proto/query.BindVariable.ValueFloat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。