Codebase list golang-github-boltdb-bolt / 41aa602
Document key/value lifecycle. This commit adds a caveat to the godoc that explains how key and value byte slices will only be valid for the life of the transaction. Ben Johnson 9 years ago
1 changed file(s) with 6 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
3232 The database uses a read-only, memory-mapped data file to ensure that
3333 applications cannot corrupt the database, however, this means that keys and
3434 values returned from Bolt cannot be changed. Writing to a read-only byte slice
35 will cause Go to panic. If you need to work with data returned from a Get() you
36 need to first copy it to a new byte slice.
35 will cause Go to panic.
36
37 Keys and values retrieved from the database are only valid for the life of
38 the transaction. When used outside the transaction, these byte slices can
39 point to different data or can point to invalid memory which will cause a panic.
40
3741
3842 */
3943 package bolt