本文整理匯總了Golang中camlistore/org/pkg/test.FakeIndex.AddClaim方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeIndex.AddClaim方法的具體用法?Golang FakeIndex.AddClaim怎麽用?Golang FakeIndex.AddClaim使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類camlistore/org/pkg/test.FakeIndex
的用法示例。
在下文中一共展示了FakeIndex.AddClaim方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: handlerDescribeTestSetupWithImage
// extends handlerDescribeTestSetup but adds a camliContentImage to pn.
func handlerDescribeTestSetupWithImage(fi *test.FakeIndex) index.Interface {
handlerDescribeTestSetup(fi)
pn := blob.MustParse("perma-123")
imageRef := blob.MustParse("fakeref-789")
fi.AddMeta(imageRef, "", 789)
fi.AddClaim(owner, pn, "set-attribute", "camliContentImage", imageRef.String())
return fi
}
示例2: addPermanode
func addPermanode(fi *test.FakeIndex, pnStr string, attrs ...string) {
pn := blob.MustParse(pnStr)
fi.AddMeta(pn, "permanode", 123)
for len(attrs) > 0 {
k, v := attrs[0], attrs[1]
attrs = attrs[2:]
fi.AddClaim(owner, pn, "add-attribute", k, v)
}
}
示例3: handlerDescribeTestSetup
func handlerDescribeTestSetup(fi *test.FakeIndex) index.Interface {
pn := blob.MustParse("perma-123")
fi.AddMeta(pn, "permanode", 123)
fi.AddClaim(owner, pn, "set-attribute", "camliContent", "fakeref-232")
fi.AddMeta(blob.MustParse("fakeref-232"), "", 878)
// Test deleting all attributes
fi.AddClaim(owner, pn, "add-attribute", "wont-be-present", "x")
fi.AddClaim(owner, pn, "add-attribute", "wont-be-present", "y")
fi.AddClaim(owner, pn, "del-attribute", "wont-be-present", "")
// Test deleting a specific attribute.
fi.AddClaim(owner, pn, "add-attribute", "only-delete-b", "a")
fi.AddClaim(owner, pn, "add-attribute", "only-delete-b", "b")
fi.AddClaim(owner, pn, "add-attribute", "only-delete-b", "c")
fi.AddClaim(owner, pn, "del-attribute", "only-delete-b", "b")
return fi
}
示例4: handlerDescribeTestSetupWithEmbeddedRefs
// extends handlerDescribeTestSetup but adds various embedded references to other nodes.
func handlerDescribeTestSetupWithEmbeddedRefs(fi *test.FakeIndex) index.Interface {
handlerDescribeTestSetup(fi)
pn := blob.MustParse("perma-123")
c1 := blob.MustParse("fakeref-01")
c2 := blob.MustParse("fakeref-02")
c3 := blob.MustParse("fakeref-03")
c4 := blob.MustParse("fakeref-04")
c5 := blob.MustParse("fakeref-05")
c6 := blob.MustParse("fakeref-06")
fi.AddMeta(c1, "", 1)
fi.AddMeta(c2, "", 2)
fi.AddMeta(c3, "", 3)
fi.AddMeta(c4, "", 4)
fi.AddMeta(c5, "", 5)
fi.AddMeta(c6, "", 6)
fi.AddClaim(owner, pn, "set-attribute", c1.String(), "foo")
fi.AddClaim(owner, pn, "set-attribute", "foo,"+c2.String()+"=bar", "foo")
fi.AddClaim(owner, pn, "set-attribute", "foo:"+c3.String()+"?bar,"+c4.String(), "foo")
fi.AddClaim(owner, pn, "set-attribute", "foo", c5.String())
fi.AddClaim(owner, pn, "add-attribute", "bar", "baz")
fi.AddClaim(owner, pn, "add-attribute", "bar", "monkey\n"+c6.String())
return fi
}