Skip to content

Commit

Permalink
add integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul2393 committed Dec 12, 2023
1 parent 4c93151 commit 2133585
Show file tree
Hide file tree
Showing 4 changed files with 200 additions and 172 deletions.
10 changes: 10 additions & 0 deletions spanner/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"cloud.google.com/go/internal/trace"
sppb "cloud.google.com/go/spanner/apiv1/spannerpb"
"github.com/googleapis/gax-go/v2"
jsoniter "github.com/json-iterator/go"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
"google.golang.org/api/option/internaloption"
Expand Down Expand Up @@ -186,6 +187,10 @@ type ClientConfig struct {

// BatchTimeout specifies the timeout for a batch of sessions managed sessionClient.
BatchTimeout time.Duration

// UseNumber causes the Decoder to unmarshal a number into an interface{} as a
// Number instead of as a float64.
UseNumber bool
}

func contextWithOutgoingMetadata(ctx context.Context, md metadata.MD, disableRouteToLeader bool) context.Context {
Expand Down Expand Up @@ -265,6 +270,11 @@ func NewClientWithConfig(ctx context.Context, database string, config ClientConf
if config.BatchTimeout == 0 {
config.BatchTimeout = time.Minute
}
jsonProvider = jsoniter.Config{
EscapeHTML: true,
SortMapKeys: true, // Sort map keys to ensure deterministic output, to be consistent with encoding.
UseNumber: config.UseNumber,
}.Froze()

md := metadata.Pairs(resourcePrefixHeader, database)
if config.Compression == gzip.Name {
Expand Down
Loading

0 comments on commit 2133585

Please sign in to comment.