本文整理匯總了Golang中camlistore/org/pkg/schema.Claim.ClaimType方法的典型用法代碼示例。如果您正苦於以下問題:Golang Claim.ClaimType方法的具體用法?Golang Claim.ClaimType怎麽用?Golang Claim.ClaimType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類camlistore/org/pkg/schema.Claim
的用法示例。
在下文中一共展示了Claim.ClaimType方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: populateDeleteClaim
// populateDeleteClaim adds to mm the entries resulting from the delete claim cl.
// It is assumed cl is a valid claim, and vr has already been verified.
func (ix *Index) populateDeleteClaim(cl schema.Claim, vr *jsonsign.VerifyRequest, mm *mutationMap) {
br := cl.Blob().BlobRef()
target := cl.Target()
if !target.Valid() {
log.Print(fmt.Errorf("no valid target for delete claim %v", br))
return
}
meta, err := ix.GetBlobMeta(target)
if err != nil {
if err == os.ErrNotExist {
// TODO: return a dependency error type, to schedule re-indexing in the future
}
log.Print(fmt.Errorf("Could not get mime type of target blob %v: %v", target, err))
return
}
// TODO(mpl): create consts somewhere for "claim" and "permanode" as camliTypes, and use them,
// instead of hardcoding. Unless they already exist ? (didn't find them).
if meta.CamliType != "permanode" && meta.CamliType != "claim" {
log.Print(fmt.Errorf("delete claim target in %v is neither a permanode nor a claim: %v", br, meta.CamliType))
return
}
mm.Set(keyDeleted.Key(target, cl.ClaimDateString(), br), "")
if meta.CamliType == "claim" {
return
}
recentKey := keyRecentPermanode.Key(vr.SignerKeyId, cl.ClaimDateString(), br)
mm.Set(recentKey, target.String())
attr, value := cl.Attribute(), cl.Value()
claimKey := keyPermanodeClaim.Key(target, vr.SignerKeyId, cl.ClaimDateString(), br)
mm.Set(claimKey, keyPermanodeClaim.Val(cl.ClaimType(), attr, value, vr.CamliSigner))
}