Граф коммитов

8 Коммитов

Автор SHA1 Сообщение Дата
Sarah Adams 4a8ba85959 datastore: refactor in preparation for loading nested entity values
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
2016-10-05 23:10:42 +00:00
David Symonds d1e7e222a2 Remove internal.CallOptions entirely, and use the context's timeout for API calls.
Change-Id: I3fef83cf331c857e6c8c552eed89a34cd0ea6e1c
2015-01-28 16:44:06 +11:00
David Symonds 1c3fdc51e1 Convert tree from appengine.Context to context.Context.
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
2015-01-21 09:10:09 +11:00
Dave Day 6aa6740702 appengine/datastore: GetMulti should accept the zero-valued []*S
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
2015-01-14 13:42:22 +11:00
David Symonds c98f627282 Update code and regenerate .pb.go files for new location of goprotobuf.
Change-Id: I1d64ba6bf13fd7fc2fa9c4c7addc7163ef8a26ee
2014-11-25 11:47:41 +11:00
David Symonds 9e7af23396 Change import paths from github.com/golang/appengine to google.golang.org/appengine.
Change-Id: I653ceae860405a5e2d699908eb975a97ee64495b
2014-02-05 11:47:53 +11:00
David Symonds de1373dd66 Make import grouping consistent.
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
2014-01-28 15:52:57 +11:00
David Symonds 368ec81cc1 Add datastore package.
Change-Id: Ia3676ed444676369813fd2cd11565a47835a1e2c
2014-01-17 12:34:11 -08:00