mirror of https://github.com/hak5/bolt.git
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.master
parent
0329b03f58
commit
41aa602f27
8
doc.go
8
doc.go
|
@ -33,8 +33,12 @@ Caveats
|
|||
The database uses a read-only, memory-mapped data file to ensure that
|
||||
applications cannot corrupt the database, however, this means that keys and
|
||||
values returned from Bolt cannot be changed. Writing to a read-only byte slice
|
||||
will cause Go to panic. If you need to work with data returned from a Get() you
|
||||
need to first copy it to a new byte slice.
|
||||
will cause Go to panic.
|
||||
|
||||
Keys and values retrieved from the database are only valid for the life of
|
||||
the transaction. When used outside the transaction, these byte slices can
|
||||
point to different data or can point to invalid memory which will cause a panic.
|
||||
|
||||
|
||||
*/
|
||||
package bolt
|
||||
|
|
Loading…
Reference in New Issue