• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..18-Jun-2020-

admin/apiv1/H18-Jun-2020-737418

internal/gaepb/H18-Jun-2020-433394

testdata/H18-Jun-2020-4135

CHANGES.mdH A D18-Jun-2020862 2317

README.mdH A D18-Jun-20201.2 KiB4135

client.goH A D18-Jun-20203.9 KiB12186

datastore.goH A D18-Jun-202019.9 KiB672488

datastore_test.goH A D18-Jun-202072.2 KiB3,5733,315

doc.goH A D18-Jun-202015.9 KiB5091

errors.goH A D18-Jun-20201.2 KiB4825

example_test.goH A D18-Jun-202013.8 KiB594442

go.modH A D18-Jun-2020568 1815

go.sumH A D18-Jun-202045.6 KiB474473

go_mod_tidy_hack.goH A D18-Jun-2020920 232

integration_test.goH A D18-Jun-202032.8 KiB1,3351,151

key.goH A D18-Jun-20207 KiB294207

key_test.goH A D18-Jun-20204.9 KiB211184

keycompat.goH A D18-Jun-20201.8 KiB6738

keycompat_test.goH A D18-Jun-20201.7 KiB5637

load.goH A D18-Jun-202014.6 KiB551420

load_test.goH A D18-Jun-202024.9 KiB1,1391,024

mutation.goH A D18-Jun-20203.6 KiB13595

mutation_test.goH A D18-Jun-20203.5 KiB151132

oc_test.goH A D18-Jun-20201.1 KiB4423

prop.goH A D18-Jun-20209.5 KiB340206

query.goH A D18-Jun-202022.5 KiB789547

query_test.goH A D18-Jun-202014.3 KiB571492

save.goH A D18-Jun-202013.3 KiB485385

save_test.goH A D18-Jun-20208 KiB375337

time.goH A D18-Jun-20201.2 KiB3715

time_test.goH A D18-Jun-20202.4 KiB7655

transaction.goH A D18-Jun-202012.6 KiB406269

transaction_test.goH A D18-Jun-20202.1 KiB7860

README.md

1## Cloud Datastore [![GoDoc](https://godoc.org/cloud.google.com/go/datastore?status.svg)](https://godoc.org/cloud.google.com/go/datastore)
2
3- [About Cloud Datastore](https://cloud.google.com/datastore/)
4- [Activating the API for your project](https://cloud.google.com/datastore/docs/activate)
5- [API documentation](https://cloud.google.com/datastore/docs)
6- [Go client documentation](https://godoc.org/cloud.google.com/go/datastore)
7- [Complete sample program](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/datastore/tasks)
8
9### Example Usage
10
11First create a `datastore.Client` to use throughout your application:
12
13[snip]:# (datastore-1)
14```go
15client, err := datastore.NewClient(ctx, "my-project-id")
16if err != nil {
17	log.Fatal(err)
18}
19```
20
21Then use that client to interact with the API:
22
23[snip]:# (datastore-2)
24```go
25type Post struct {
26	Title       string
27	Body        string `datastore:",noindex"`
28	PublishedAt time.Time
29}
30keys := []*datastore.Key{
31	datastore.NameKey("Post", "post1", nil),
32	datastore.NameKey("Post", "post2", nil),
33}
34posts := []*Post{
35	{Title: "Post 1", Body: "...", PublishedAt: time.Now()},
36	{Title: "Post 2", Body: "...", PublishedAt: time.Now()},
37}
38if _, err := client.PutMulti(ctx, keys, posts); err != nil {
39	log.Fatal(err)
40}
41```