tree: 6896f974aaec4f0ff9bb919dab48c5f4086fc66f [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. spannertest/
  40. spansql/
  41. statement.go
  42. statement_test.go
  43. stats.go
  44. timestampbound.go
  45. timestampbound_test.go
  46. transaction.go
  47. transaction_test.go
  48. value.go
  49. value_benchmarks_test.go
  50. 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)
}