本文整理匯總了Golang中hyperdex/client.Client.GetPartial方法的典型用法代碼示例。如果您正苦於以下問題:Golang Client.GetPartial方法的具體用法?Golang Client.GetPartial怎麽用?Golang Client.GetPartial使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類hyperdex/client.Client
的用法示例。
在下文中一共展示了Client.GetPartial方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: main
func main() {
var attrs client.Attributes
var objs chan client.Attributes
var errs chan client.Error
_ = attrs
_ = objs
_ = errs
var c *client.Client
var err client.Error
port, _ := strconv.Atoi(os.Args[2])
c, er, _ := client.NewClient(os.Args[1], port)
if er != nil {
fmt.Println(err)
os.Exit(1)
}
attrs, err = c.Get("kv", "k")
if err.Status != client.NOTFOUND {
fmt.Printf("bad status: %d (should be NOTFOUND)\n", err)
}
err = c.Put("kv", "k", client.Attributes{"v1": "ABC"})
if err.Status != client.SUCCESS {
os.Exit(1)
}
attrs, err = c.Get("kv", "k")
if err.Status != client.SUCCESS {
fmt.Printf("bad status: %d (should be SUCCESS)\n", err.Status)
}
if !sloppyEqualAttributes(attrs, client.Attributes{"v1": "ABC", "v2": ""}) {
fmt.Printf("%s %s\n", attrs, client.Map{"v1": "ABC", "v2": ""})
panic("objects not equal")
}
err = c.Put("kv", "k", client.Attributes{"v2": "123"})
if err.Status != client.SUCCESS {
os.Exit(1)
}
attrs, err = c.Get("kv", "k")
if err.Status != client.SUCCESS {
fmt.Printf("bad status: %d (should be SUCCESS)\n", err.Status)
}
if !sloppyEqualAttributes(attrs, client.Attributes{"v1": "ABC", "v2": "123"}) {
fmt.Printf("%s %s\n", attrs, client.Map{"v1": "ABC", "v2": "123"})
panic("objects not equal")
}
attrs, err = c.GetPartial("kv", "k", []string{"v1"})
if err.Status != client.SUCCESS {
fmt.Printf("bad status: %d (should be SUCCESS)\n", err.Status)
}
if !sloppyEqualAttributes(attrs, client.Attributes{"v1": "ABC"}) {
fmt.Printf("%s %s\n", attrs, client.Map{"v1": "ABC"})
panic("objects not equal")
}
os.Exit(0)
}