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