Skip to content

Commit

Permalink
feat(spanner): Add option to disable closing spanner clients
Browse files Browse the repository at this point in the history
  • Loading branch information
jtwatson committed May 7, 2023
1 parent 84009cf commit e011fdd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions database/spanner/spanner.go
Expand Up @@ -56,6 +56,9 @@ type Config struct {
// Parsing outputs clean DDL statements such as reformatted
// and void of comments.
CleanStatements bool
// DoNotCloseSpannerClients turns Close() into a no-op so the
// provided spanner clients are not closed
DoNotCloseSpannerClients bool
}

// Spanner implements database.Driver for Google Cloud Spanner
Expand Down Expand Up @@ -146,6 +149,9 @@ func (s *Spanner) Open(url string) (database.Driver, error) {

// Close implements database.Driver
func (s *Spanner) Close() error {
if s.config.DoNotCloseSpannerClients {
return nil
}
s.db.data.Close()
return s.db.admin.Close()
}
Expand Down

0 comments on commit e011fdd

Please sign in to comment.