tree: 2a303e193eb1407fbe1acbb6cd2c4b1c02971d40 [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_test.go
  11. cmp_test.go
  12. doc.go
  13. errors.go
  14. errors112.go
  15. errors113.go
  16. errors_test.go
  17. examples_test.go
  18. go.mod
  19. go.sum
  20. go_mod_tidy_hack.go
  21. integration_test.go
  22. internal/
  23. key.go
  24. key_test.go
  25. mutation.go
  26. mutation_test.go
  27. not_appengine.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)
}