tree: 15408f319234254c57a9145bdaab4775b1e8337d [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_enablexds.go
  14. client_test.go
  15. cmp_test.go
  16. doc.go
  17. emulator_test.sh
  18. errors.go
  19. errors112.go
  20. errors113.go
  21. errors_test.go
  22. examples_test.go
  23. go.mod
  24. go.sum
  25. integration_test.go
  26. key.go
  27. key_test.go
  28. mutation.go
  29. mutation_test.go
  30. oc_test.go
  31. pdml.go
  32. pdml_test.go
  33. protoutils.go
  34. read.go
  35. read_test.go
  36. README.md
  37. release-please-config.json
  38. retry.go
  39. retry_test.go
  40. row.go
  41. row_test.go
  42. session.go
  43. session_test.go
  44. sessionclient.go
  45. sessionclient_test.go
  46. statement.go
  47. statement_test.go
  48. stats.go
  49. timestampbound.go
  50. timestampbound_test.go
  51. transaction.go
  52. transaction_test.go
  53. value.go
  54. value_benchmarks_test.go
  55. 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)
}