Merge pull request #257 from alecgrieser/cherrypick-docs-and-go-install-fixes

Cherrypick docs and go install fixes
This commit is contained in:
John Brownlee 2018-04-27 11:11:54 -07:00 committed by GitHub
commit 816cceae09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -167,7 +167,7 @@ else
if [[ "${status}" -eq 0 ]] ; then
destdir=$( cd "${destdir}" && pwd ) # Get absolute path of destination dir.
fdbdir="${destdir}/foundation"
fdbdir="${destdir}/foundationdb"
if [[ ! -d "${destdir}" ]] ; then
cmd=("mkdir" "-p" "${destdir}")

View File

@ -394,8 +394,8 @@ Transactional decoration
@fdb.transactional
def simple_function(tr, x, y):
tr['foo'] = x
tr['bar'] = y
tr[b'foo'] = x
tr[b'bar'] = y
The ``@fdb.transactional`` decorator makes ``simple_function`` a transactional function. All functions using this decorator must have an argument **named** ``tr``. This specially named argument is passed a transaction that the function can use to do reads and writes.
@ -893,7 +893,7 @@ Asynchronous methods return one of the following subclasses of :class:`Future`:
@fdb.transactional
def foo(tr):
val = tr['foo']
val = tr[b'foo']
if val.present():
print 'Got value: %s' % val
else:

View File

@ -38,11 +38,11 @@ Next, we open a FoundationDB database. The API will connect to the FoundationDB
We are ready to use the database. In Python, using the ``[]`` operator on the db object is a convenient syntax for performing a read or write on the database. First, let's simply write a key-value pair:
>>> db['hello'] = 'world'
>>> db[b'hello'] = b'world'
When this command returns without exception, the modification is durably stored in FoundationDB! Under the covers, this function creates a transaction with a single modification. We'll see later how to do multiple operations in a single transaction. For now, let's read back the data::
>>> print 'hello', db['hello']
>>> print 'hello', db[b'hello']
hello world
If this is all working, it looks like we are ready to start building a real application. For reference, here's the full code for "hello world"::
@ -50,8 +50,8 @@ If this is all working, it looks like we are ready to start building a real appl
import fdb
fdb.api_version(510)
db = fdb.open()
db['hello'] = 'world'
print 'hello', db['hello']
db[b'hello'] = b'world'
print 'hello', db[b'hello']
Class scheduling application
============================