Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/ddl-batches/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func ddlBatches(projectId, instanceId, databaseId string) error {
if err != nil {
return fmt.Errorf("failed to get connection: %v", err)
}
defer conn.Close()
// Start a DDL batch on the connection.
if _, err := conn.ExecContext(ctx, "START BATCH DDL"); err != nil {
return fmt.Errorf("START BATCH DDL failed: %v", err)
Expand Down
1 change: 1 addition & 0 deletions examples/dml-batches/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func dmlBatch(projectId, instanceId, databaseId string) error {
if err != nil {
return fmt.Errorf("failed to get connection: %v", err)
}
defer conn.Close()
if err := conn.Raw(func(driverConn interface{}) error {
return driverConn.(spannerdriver.SpannerConn).StartBatchDML()
}); err != nil {
Expand Down
1 change: 1 addition & 0 deletions examples/mutations/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func mutations(projectId, instanceId, databaseId string) error {
if err != nil {
return err
}
defer conn.Close()

// Mutations can be written outside an explicit transaction using SpannerConn#Apply.
var commitTimestamp time.Time
Expand Down
1 change: 1 addition & 0 deletions examples/partitioned-dml/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func partitionedDml(projectId, instanceId, databaseId string) error {
if err != nil {
return fmt.Errorf("failed to get a connection: %v", err)
}
defer conn.Close()
if err := conn.Raw(func(driverConn interface{}) error {
_, err := driverConn.(spannerdriver.SpannerConn).Apply(ctx, []*spanner.Mutation{
spanner.InsertOrUpdateMap("Singers", map[string]interface{}{"SingerId": 1, "Name": "Singer 1"}),
Expand Down
1 change: 1 addition & 0 deletions examples/stale-reads/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func staleReads(projectId, instanceId, databaseId string) error {
if err != nil {
return err
}
defer conn.Close()
if _, err := conn.ExecContext(ctx, fmt.Sprintf("SET READ_ONLY_STALENESS='READ_TIMESTAMP %s'", t.Format(time.RFC3339Nano))); err != nil {
return err
}
Expand Down
Loading