Skip to content

Commit 9c48518

Browse files
committed
feat(spanner): Add option to disable closing spanner clients
1 parent 0d41589 commit 9c48518

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

database/spanner/spanner.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ type Config struct {
5656
// Parsing outputs clean DDL statements such as reformatted
5757
// and void of comments.
5858
CleanStatements bool
59+
// DoNotCloseSpannerClients turns Close() into a no-op so the
60+
// provided spanner clients are not closed
61+
DoNotCloseSpannerClients bool
5962
}
6063

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

147150
// Close implements database.Driver
148151
func (s *Spanner) Close() error {
152+
if s.config.DoNotCloseSpannerClients {
153+
return nil
154+
}
149155
s.db.data.Close()
150156
return s.db.admin.Close()
151157
}

0 commit comments

Comments
 (0)