tessl install tessl/golang-cloud-google-com--go--spanner@1.87.2Official Google Cloud Spanner client library for Go providing comprehensive database operations, transactions, and admin functionality
Direct access to low-level Spanner gRPC APIs for advanced use cases.
Low-level Spanner client:
import spannerapi "cloud.google.com/go/spanner/apiv1"
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error)This package provides direct access to the Spanner gRPC API. Most applications should use the higher-level cloud.google.com/go/spanner package instead.
When to use:
Example:
import spannerapi "cloud.google.com/go/spanner/apiv1"
ctx := context.Background()
client, err := spannerapi.NewClient(ctx)
if err != nil {
log.Fatal(err)
}
defer client.Close()
// Use low-level API methods
// See package documentation for available methodsFor complete API reference, see the apiv1 package documentation.
The low-level API is appropriate when:
cloud.google.com/go/spanner unless you have specific needscloud.google.com/go/spanner/apiv1/spannerpbSee protobuf-types.md for protobuf type definitions.