diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-06-16 09:42:59 -0600 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-06-16 09:42:59 -0600 |
commit | 41aa602f27eac4ac84cfb775f41cde964514fd10 (patch) | |
tree | f1b1c101c26f11d1277b67560202d86686b08026 /doc.go | |
parent | Merge pull request #193 from benbjohnson/check-freelist-overflow (diff) | |
download | dedo-41aa602f27eac4ac84cfb775f41cde964514fd10.tar.gz dedo-41aa602f27eac4ac84cfb775f41cde964514fd10.tar.xz |
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.
Diffstat (limited to 'doc.go')
-rw-r--r-- | doc.go | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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 |