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