本文整理汇总了Golang中github.com/youtube/vitess/go/vt/key.KeyRange.Start方法的典型用法代码示例。如果您正苦于以下问题:Golang KeyRange.Start方法的具体用法?Golang KeyRange.Start怎么用?Golang KeyRange.Start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/youtube/vitess/go/vt/key.KeyRange
的用法示例。
在下文中一共展示了KeyRange.Start方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: buildBindVarCondition
func buildBindVarCondition(bvc interface{}) (name string, onAbsent, onMismatch bool, op Operator, value interface{}, err error) {
bvcinfo, ok := bvc.(map[string]interface{})
if !ok {
err = NewTabletError(FAIL, "Expecting json object for bind var conditions")
return
}
var v interface{}
v, ok = bvcinfo["Name"]
if !ok {
err = NewTabletError(FAIL, "Name missing in BindVarConds")
return
}
name, ok = v.(string)
if !ok {
err = NewTabletError(FAIL, "Expecting string for Name in BindVarConds")
return
}
v, ok = bvcinfo["OnAbsent"]
if !ok {
err = NewTabletError(FAIL, "OnAbsent missing in BindVarConds")
return
}
onAbsent, ok = v.(bool)
if !ok {
err = NewTabletError(FAIL, "Expecting bool for OnAbsent")
return
}
v, ok = bvcinfo["Operator"]
if !ok {
err = NewTabletError(FAIL, "Operator missing in BindVarConds")
return
}
strop, ok := v.(string)
if !ok {
err = NewTabletError(FAIL, "Expecting string for Operator")
return
}
op, ok = opmap[strop]
if !ok {
err = NewTabletError(FAIL, "Invalid Operator %s", strop)
return
}
if op == QR_NOOP {
return
}
v, ok = bvcinfo["Value"]
if !ok {
err = NewTabletError(FAIL, "Value missing in BindVarConds")
return
}
if op >= QR_EQ && op <= QR_LE {
strvalue, ok := v.(string)
if !ok {
err = NewTabletError(FAIL, "Expecting string: %v", v)
return
}
if strop[0] == 'U' {
value, err = strconv.ParseUint(strvalue, 0, 64)
if err != nil {
err = NewTabletError(FAIL, "Expecting uint64: %s", strvalue)
return
}
} else if strop[0] == 'I' {
value, err = strconv.ParseInt(strvalue, 0, 64)
if err != nil {
err = NewTabletError(FAIL, "Expecting int64: %s", strvalue)
return
}
} else if strop[0] == 'S' {
value = strvalue
} else {
panic("unexpected")
}
} else if op == QR_MATCH || op == QR_NOMATCH {
strvalue, ok := v.(string)
if !ok {
err = NewTabletError(FAIL, "Expecting string: %v", v)
return
}
value = strvalue
} else if op == QR_IN || op == QR_NOTIN {
kr, ok := v.(map[string]interface{})
if !ok {
err = NewTabletError(FAIL, "Expecting keyrange for Value")
return
}
var keyrange key.KeyRange
strstart, ok := kr["Start"]
if !ok {
err = NewTabletError(FAIL, "Start missing in KeyRange")
return
}
start, ok := strstart.(string)
if !ok {
err = NewTabletError(FAIL, "Expecting string for Start")
return
}
//.........这里部分代码省略.........