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

dev: Implement String() for Connection and/or configs for print debug info on fails #908

Merged
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
* Context for call options now have same lifetime as driver (previous - same lifetime as context for call Open function).

## v3.54.3
* Implement `String` interface for `Driver` struct

## v3.54.2
* Added context to some internal methods for better tracing
* Added `trace.FunctionID` helper and `FunctionID` field to trace start info's
Expand Down
12 changes: 12 additions & 0 deletions driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ydb
import (
"context"
"errors"
"fmt"
"os"
"sync"

Expand Down Expand Up @@ -210,6 +211,17 @@ func (d *Driver) Topic() topic.Client {
return d.topic
}

// String returns string representation of Driver
func (d *Driver) String() string {
return fmt.Sprintf(
"Driver{User: %s, Endpoint: %s, Database: %s, IsSecure %t}",
d.userInfo.User,
d.config.Endpoint(),
d.config.Database(),
d.config.Secure(),
)
}

// Open connects to database by DSN and return driver runtime holder
//
// DSN accept Driver string like
Expand Down
Loading