Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(spanner): Add option to disable closing spanner clients #910

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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