Created
July 26, 2017 15:25
-
-
Save xiaoyvr/32612303088458389333e7722bf3bdda to your computer and use it in GitHub Desktop.
how couchbase sync gateway generate the document revision id
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
func createRevID(generation int, parentRevID string, body Body) string { | |
// This should produce the same results as TouchDB. | |
digester := md5.New() | |
digester.Write([]byte{byte(len(parentRevID))}) | |
digester.Write([]byte(parentRevID)) | |
digester.Write(canonicalEncoding(stripSpecialProperties(body))) | |
return fmt.Sprintf("%d-%x", generation, digester.Sum(nil)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment