go - Google App Engine Golang datastore.Query.GetAll not working locally -


I'm new to Google App Engine and meet some problems with datastore.

I continue to have a test wrote the datastore.Query.GetAll method below

see .go
  package to test GaeDatastore_test import ( "fmt" "test" " app engine / Aetest "" app engine / datastore ") fake struct {name string} write function TestAll (T * testing.T) {ctx, _: = aetest.NewContext (zero) to suspend ctx.Close () d = & Amp; Fake { "Hello",} fmt.Println (datastore.Put (ctx, data store .NewIncompleteKey (ctx, "test", nil), d)) fmt.Println (datastore.Put (ctx, datastore.NewIncompleteKey ( ctx, "test", nil), d)) fmt.Println (datastore.Put (ctx, datastore.NewIncompleteKey (ctx, "test", nil), d)) q: = datastore.NewQuery ( " Test ") MS [] Fake q.GetAll (ctx, & amp; ms) fmt.printf ("% # V ", ms)}  

When I

If I run a test file using blockquote>

goapp test

it is not return 3N I have stored the datastore which I have stored After the angle the key could see back. Pot and I could use datastore. To retrieve them using the key,

Then I tried to start MS

make ([] Mock, 10)

P> But this does not make much difference and the data is still not coming.

I checked it internally using this loadEntity which is the only method used by gate / gatemalt and uses the app to push slides to the elements. It is quite strange that MS is zero.

The customer is connecting to a Python server which is emulating GAE env. Can anyone help one?

I believe because you are querying a cross group and writing does not yet apply to the data store has been done. God looks like server production, such as write visibility when you are not in the transaction or entity group, questions will not immediately show results.

From the docs,

gives the process of writing immediately after the comma step and the apply step is then asynchronously.

And,

... applied when applied when one of the following occurs:

Periodic Datastore examines the incomplete Commit's jobs and applies them. Some operations (receiving, putting, removing and questioning of ancestors) that use the affected entity groups, any changes which are committed, but have not been implemented to fulfill the new operation even before.

And,

Because the datastore is received and apply any outstanding modifications before executing the query of ancestors, these actions are always all Let's see a continuous view of the last successful transaction. This means that an act operation (looking for an updated unit through its key) is guaranteed to see the latest version of that unit.

See more details and data visibility rules for the source of these quotes and write:

Here is a modified version of your code that returns after each insert Gets on the key. Obtain the applicable key () Make sure that your GetAll query will return to all your test entities. The package continues in the import ("fmt" "test" "app engine / aetest" "app engine / datastore") duplicate struct type {name string} Func Test All (T * test) . {Ctx, _: = aetest.NewContext (zero) defer ctx.Close () d: = & amp; Fake {"Hello"}} i: = 0; I & lt; 3; I ++ {k, err: = datastore.Put (ctx, datastore.NewIncompleteKey (ctx, "test", zero), d) fmt.println (k, err) datastore.Get (ctx, k, nil)} q : = datastore.NewQuery ( "test") var MS [] fake q.GetAll (ctx, & amp; ms) fmt.Printf ( "% # V", MS)}


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -