Skip to main content

Module entity

Module entity 

Source
Expand description

Documents as App Engine EntityProtos, the records of an export’s output-* files.

The mapping, as the official emulator writes it (docs/export-format.md):

  • the key names the project as the app dev~{project}, the database (unless (default)) and the path, a numeric document ID (__id7__) as an id, any other as a name;
  • fields are properties in field order, after the empty arrays, which are “indexed” properties of their own meaning; an array is one property per element, marked multiple;
  • a map is a nested entity without a key, stored as a string of meaning 19; a vector is a nested entity whose elements are multiple properties named __vector__;
  • timestamps are microseconds (meaning 7), bytes are strings of meaning 14, geo points are points of meaning 9; a double keeps its bits, -0.0 included.

Reading, a reference in a top-level indexed property (as a managed export of a Native mode database writes most fields) belongs to the importing project, whatever its app says: the official emulator imports it so. It is decoded with an empty project (ExportedDocument::fields_in fills it in); references anywhere else keep theirs.

Functions§

decode
Decodes an entity, as written by the official emulator or by encode. Properties may be indexed or not, in any order; the key’s app is ignored.
encode
Encodes the document at path of projects/{project}/databases/{database_id}.