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
32 | 32 | The database uses a read-only, memory-mapped data file to ensure that |
33 | 33 | applications cannot corrupt the database, however, this means that keys and |
34 | 34 | 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 | ||
37 | 41 | |
38 | 42 | */ |
39 | 43 | package bolt |