This change is a mirror of the same change submitted to
cloud.google.com/go/datastore, the goal being to keep the two packages
as similar as possible.
This change does not alter the black-box/user-facing behavior of the
datastore package.
Refactors:
load() is now able to load nested structs both with flattened field
values (eg. "A.B.C") and nested entities (eg. "A").
structCodec has been refactored in several ways:
1. we only need to store one copy of all the fields (now named 'fields'),
instead of 2 copies ('byName' and 'byIndex').
2. we now store the 'index' of a field in fieldCodec as 'path' (a
slice of indicies) to better acommodate anonymous, nested struct fields.
3. we no longer store unexported fields in the structCodecs, as they are
never used anyway.
4. nested structs are saved in structCodec as "A" (pointing to the
structCodec of field A), instead of "A.B" (pointing to the structCodec
of A) to de-dupe entries with the same index and same struct codec.
Change-Id: I5288dfbffe03e6a8d8ff416707591d3eecb52b28
Most well-formed application code will require minimal changes:
- The type is now golang.org/x/net/context.(*Context).
- c := appengine.NewContext(r) still works.
- Most API calls still look exactly the same.
- Logging now uses the google.golang.org/appengine/log package.
Change-Id: I7fa089efa8d0b1e7beeeb6233a98fe054020b1fc
At the moment, GetMulti accepts []*S but requires that each element has
been initialised to point to a valid struct. After this change, the
following will work:
keys := []*datastore.Key{…}
dst := make([]*MyStruct, len(keys))
err := datastore.MultiGet(c, keys, dst)
Change-Id: I0596770cbb92bddf2cad4f625ef93f8ce44b6ad4
The new canonical import grouping for this repository is now:
- standard library packages
- external third-party packages (e.g. goprotobuf)
- appengine packages (including protos)
Change-Id: Idea20258e726e4f5c9dcf1520e26dc3ef09d9afc