當前位置: 首頁>>代碼示例>>Golang>>正文


Golang FakeIndex.AddMeta方法代碼示例

本文整理匯總了Golang中camlistore/org/pkg/test.FakeIndex.AddMeta方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeIndex.AddMeta方法的具體用法?Golang FakeIndex.AddMeta怎麽用?Golang FakeIndex.AddMeta使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在camlistore/org/pkg/test.FakeIndex的用法示例。


在下文中一共展示了FakeIndex.AddMeta方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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
}
開發者ID:camarox53,項目名稱:coreos-baremetal,代碼行數:9,代碼來源:handler_test.go

示例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)
	}
}
開發者ID:pombredanne,項目名稱:camlistore,代碼行數:9,代碼來源:describe_test.go

示例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
}
開發者ID:camarox53,項目名稱:coreos-baremetal,代碼行數:18,代碼來源:handler_test.go

示例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
}
開發者ID:camarox53,項目名稱:coreos-baremetal,代碼行數:24,代碼來源:handler_test.go

示例5: addFileWithLocation

func addFileWithLocation(fi *test.FakeIndex, fileStr string, lat, long float64) {
	fileRef := blob.MustParse(fileStr)
	fi.AddFileLocation(fileRef, camtypes.Location{Latitude: lat, Longitude: long})
	fi.AddMeta(fileRef, "file", 123)
}
開發者ID:camlistore,項目名稱:camlistore,代碼行數:5,代碼來源:describe_test.go


注:本文中的camlistore/org/pkg/test.FakeIndex.AddMeta方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。