-
-
Save adamcfraser/1a8c35b9a741f1484f9db75b42eaaf86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a document with a system xattr | |
xattr := "_sync" | |
k := "foo" | |
v := make(map[string]interface{}) | |
v["body_field"] = "1234" | |
xv := make(map[string]interface{}) | |
xv["seq"] = 123 | |
xv["rev"] = "1-1234" | |
newCas, err := bucket.Insert(k, &val, uint32(0)) | |
docFragment, err := bucket.MutateIn(k, newCas, uint32(exp)). | |
UpsertEx(xattr, xv, gocb.SubdocFlagXattr|gocb.SubdocFlagCreatePath). | |
Execute() | |
// Delete the document | |
bucket.Remove(k, 0) | |
// Attempt to retrieve the xattr for the deleted document. Returns error, no xattr in res. | |
accessDeletedFlag := gocb.SubdocFlag(0x08) | |
res, err := bucket.Bucket.LookupIn(k). | |
GetEx(xattr, accessDeletedFlag|gocb.SubdocFlagXattr). | |
Execute() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment