This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"requires": [ | |
"getmodelnodebyid", | |
"coalesce" | |
], | |
"transform-t": { | |
"!": { | |
":": { | |
"!": { | |
":": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"coordinates": null, | |
"favorited": false, | |
"truncated": false, | |
"created_at": "Wed Aug 29 17:12:58 +0000 2012", | |
"id_str": "240859602684612608", | |
"entities": { | |
"urls": [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"characters": [ | |
{ | |
"fullname": "Ambassador Kosh", | |
"saying": "Yes" | |
}, | |
{ | |
"fullname": "Worf" | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"characters": [ | |
{ | |
"_type": "section", | |
"path": "$.items[*]", | |
"transform": { | |
"fullname": "#@.name", | |
"saying": { | |
"_type": "section", | |
"path": "@.quote", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cursor": "8b08006b-963a-6909-c132-cc618cd4b352", | |
"more": true, | |
"items": [ | |
{ | |
"name": "Ambassador Kosh", | |
"type": "Vorlonn", | |
"resources": { | |
"website": "http://babylon5.wikia.com/wiki/Kosh", | |
"quote": "Yes" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fooschema = <some schema> | |
var footransform = <some transform> | |
var foo = function(inputmas) { | |
JsonSchema.validate(inputmas, fooschema) | |
return JsonTransform.transform(inputmas, footransform) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Greeting(ndb.Model): | |
... | |
def _post_put_hook(self, future): | |
# replace the document for this object in the relevant search index | |
@classmethod | |
def _post_delete_hook(cls, key, future): | |
# delete the document for this object from the relevant search index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Greeting(ndb.Model): | |
... | |
def _post_put_hook(self, future): | |
# replace the document for this object in the relevant search index | |
@classmethod | |
def _post_delete_hook(cls, key, future): | |
# delete the document for this object from the relevant search index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Greeting(ndb.Model): | |
"""Models an individual Guestbook entry with content and date.""" | |
content = ndb.StringProperty() | |
date = ndb.DateTimeProperty(auto_now_add=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a generic map function for the datastore. | |
# Suitable for passing to the PromiseSpace.when() method. | |
# outerresolve: this function is called when the mapping is complete, with the full result. | |
# promiseSpace: a promise space, to be used for making promises. | |
# dsQuery: an ndb datastore query. | |
# mapF: an optional map function. Takes an object or key (depending on keyOnly) and returns something. | |
# reduceF: an optional reduce function. Takes a list of results of mapping and a previous return value | |
# from reduceF, and returns a new value | |
# keyOnly: determines whether the queries fetch objects or just keys | |
# pageSize: size of the pages fetched from the query |
NewerOlder