1## Cloud Datastore [![Go Reference](https://pkg.go.dev/badge/cloud.google.com/go/datastore.svg)](https://pkg.go.dev/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://pkg.go.dev/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```
42