tree: a182eff23e69bc6b1a318112bef190698d5e8c4d [path history] [tgz]
  1. CHANGES.md
  2. README.md
  3. admin/
  4. apiv1/
  5. appengine.go
  6. batch.go
  7. batch_test.go
  8. big_pdml_test.go
  9. client.go
  10. client_benchmarks_test.go
  11. client_test.go
  12. cmp_test.go
  13. doc.go
  14. emulator_test.sh
  15. errors.go
  16. errors112.go
  17. errors113.go
  18. errors_test.go
  19. examples_test.go
  20. go.mod
  21. go.sum
  22. go_mod_tidy_hack.go
  23. integration_test.go
  24. internal/
  25. key.go
  26. key_test.go
  27. mutation.go
  28. mutation_test.go
  29. not_appengine.go
  30. oc_test.go
  31. pdml.go
  32. pdml_test.go
  33. protoutils.go
  34. read.go
  35. read_test.go
  36. retry.go
  37. retry_test.go
  38. row.go
  39. row_test.go
  40. session.go
  41. session_test.go
  42. sessionclient.go
  43. sessionclient_test.go
  44. spannertest/
  45. spansql/
  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 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)
}