or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
golangpkg:golang/cloud.google.com/go/spanner@v1.87.0

docs

client.mddml.mdindex.mdkeys.mdlow-level.mdprotobuf-types.mdreads.mdtesting.mdtransactions.mdtypes.mdwrites.md
tile.json

tessl/golang-cloud-google-com--go--spanner

tessl install tessl/golang-cloud-google-com--go--spanner@1.87.2

Official Google Cloud Spanner client library for Go providing comprehensive database operations, transactions, and admin functionality

low-level.mddocs/

Low-Level gRPC Access

Direct access to low-level Spanner gRPC APIs for advanced use cases.

apiv1 Package

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:

  • Custom retry logic needed
  • Direct protocol buffer access required
  • Unsupported features in high-level client
  • Performance optimization for specific use cases

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 methods

For complete API reference, see the apiv1 package documentation.

When to Use Low-Level API

The low-level API is appropriate when:

  1. Custom Session Management: You need full control over session lifecycle
  2. Direct Streaming: Working with streaming RPCs directly
  3. Protocol Buffer Access: Need access to raw protobuf messages
  4. Performance Tuning: Micro-optimizations for specific workloads
  5. Experimental Features: Features not yet exposed in high-level client

Best Practices

  1. Prefer high-level client: Use cloud.google.com/go/spanner unless you have specific needs
  2. Understand implications: Low-level API requires manual resource management
  3. Handle retries: Implement your own retry logic
  4. Manage sessions: Properly create, maintain, and delete sessions
  5. Reference protobuf types: Import cloud.google.com/go/spanner/apiv1/spannerpb

See protobuf-types.md for protobuf type definitions.