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

Cloud Spanner Go Reference

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