本文整理汇总了Golang中github.com/concourse/atc/db.DB.SaveImageResourceVersion方法的典型用法代码示例。如果您正苦于以下问题:Golang DB.SaveImageResourceVersion方法的具体用法?Golang DB.SaveImageResourceVersion怎么用?Golang DB.SaveImageResourceVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/concourse/atc/db.DB
的用法示例。
在下文中一共展示了DB.SaveImageResourceVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
jobBuild, err := pipelineDB.CreateJobBuild("some-job")
Expect(err).NotTo(HaveOccurred())
// To show that it returns volumes that are used in both one-off builds and job builds
volume1 := db.Volume{
WorkerName: "worker-1",
TTL: 2 * time.Minute,
Handle: "volume-1",
VolumeIdentifier: db.VolumeIdentifier{
ResourceVersion: atc.Version{"digest": "digest-1"},
ResourceHash: `docker:{"repository":"repository-1"}`,
},
}
err = database.InsertVolume(volume1)
Expect(err).NotTo(HaveOccurred())
err = database.SaveImageResourceVersion(oneOffBuildA.ID, "plan-id-1", volume1.VolumeIdentifier)
Expect(err).NotTo(HaveOccurred())
err = database.SaveImageResourceVersion(jobBuild.ID, "plan-id-1", volume1.VolumeIdentifier)
Expect(err).NotTo(HaveOccurred())
// To show that it can return more than one volume per build ID
volume2 := db.Volume{
WorkerName: "worker-2",
TTL: 2 * time.Minute,
Handle: "volume-2",
VolumeIdentifier: db.VolumeIdentifier{
ResourceVersion: atc.Version{"digest": "digest-2"},
ResourceHash: `docker:{"repository":"repository-2"}`,
},
}
err = database.InsertVolume(volume2)