tree: bbe359cd16ee4b1099de04a76f52abf79bb3295f [path history] [tgz]
  1. .repo-metadata.json
  2. CHANGES.md
  3. README.md
  4. admin/
  5. apiv1/
  6. appengine.go
  7. batch.go
  8. batch_test.go
  9. big_pdml_test.go
  10. client.go
  11. client_test.go
  12. cmp_test.go
  13. doc.go
  14. errors.go
  15. errors_test.go
  16. examples_test.go
  17. go.mod
  18. go.sum
  19. go_mod_tidy_hack.go
  20. integration_test.go
  21. internal/
  22. key.go
  23. key_test.go
  24. mutation.go
  25. mutation_test.go
  26. not_appengine.go
  27. oc_test.go
  28. pdml.go
  29. pdml_test.go
  30. protoutils.go
  31. read.go
  32. read_test.go
  33. retry.go
  34. retry_test.go
  35. row.go
  36. row_test.go
  37. session.go
  38. session_test.go
  39. sessionclient.go
  40. sessionclient_test.go
  41. spannertest/
  42. spansql/
  43. statement.go
  44. statement_test.go
  45. stats.go
  46. timestampbound.go
  47. timestampbound_test.go
  48. transaction.go
  49. transaction_test.go
  50. value.go
  51. value_benchmarks_test.go
  52. value_test.go
spanner/README.md

Cloud Spanner GoDoc

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)
}