Skip to content

Commit

Permalink
sql/sqlclient: add helper to check if driver was registered (#3115)
Browse files Browse the repository at this point in the history
  • Loading branch information
a8m committed Sep 12, 2024
1 parent 67c6213 commit c70602b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sql/sqlclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,12 @@ func Open(ctx context.Context, s string, opts ...OpenOption) (*Client, error) {
return OpenURL(ctx, u, opts...)
}

// HasDriver reports if there is any driver registered with the given scheme.
func HasDriver(scheme string) bool {
_, ok := drivers.Load(scheme)
return ok
}

// OpenURL opens an Atlas client by its provided url.URL.
func OpenURL(ctx context.Context, u *url.URL, opts ...OpenOption) (*Client, error) {
cfg := &openOptions{}
Expand Down

0 comments on commit c70602b

Please sign in to comment.