Skip to content

Commit e42533e

Browse files
committed
make Option public, and rename SetOptions to Apply
1 parent 5f2654f commit e42533e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dsn.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ type Config struct {
7777

7878
// Functional Options Pattern
7979
// https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis
80-
type option func(*Config) error
80+
type Option func(*Config) error
8181

8282
// NewConfig creates a new Config and sets default values.
8383
func NewConfig() *Config {
@@ -92,7 +92,7 @@ func NewConfig() *Config {
9292
return cfg
9393
}
9494

95-
func (c *Config) SetOptions(opts ...option) error {
95+
func (c *Config) Apply(opts ...Option) error {
9696
for _, opt := range opts {
9797
err := opt(c)
9898
if err != nil {
@@ -104,7 +104,7 @@ func (c *Config) SetOptions(opts ...option) error {
104104

105105
// TimeTruncate sets the time duration to truncate time.Time values in
106106
// query parameters.
107-
func TimeTruncate(d time.Duration) option {
107+
func TimeTruncate(d time.Duration) Option {
108108
return func(cfg *Config) error {
109109
cfg.timeTruncate = d
110110
return nil

0 commit comments

Comments
 (0)