b4f5d38916 | ||
---|---|---|
.. | ||
admin/instance/apiv1 | ||
apiv1 | ||
CHANGES.md | ||
LICENSE | ||
README.md | ||
appengine.go | ||
batch.go | ||
client.go | ||
doc.go | ||
errors.go | ||
errors112.go | ||
errors113.go | ||
go.mod | ||
go.sum | ||
go_mod_tidy_hack.go | ||
key.go | ||
mutation.go | ||
not_appengine.go | ||
pdml.go | ||
protoutils.go | ||
read.go | ||
retry.go | ||
row.go | ||
session.go | ||
sessionclient.go | ||
statement.go | ||
stats.go | ||
timestampbound.go | ||
transaction.go | ||
value.go |
README.md
Cloud Spanner
Example Usage
First create a spanner.Client
to use throughout your application:
client, err := spanner.NewClient(ctx, "projects/P/instances/I/databases/D")
if err != nil {
log.Fatal(err)
}
// Simple Reads And Writes
_, err = client.Apply(ctx, []*spanner.Mutation{
spanner.Insert("Users",
[]string{"name", "email"},
[]interface{}{"alice", "a@example.com"})})
if err != nil {
log.Fatal(err)
}
row, err := client.Single().ReadRow(ctx, "Users",
spanner.Key{"alice"}, []string{"email"})
if err != nil {
log.Fatal(err)
}