Skip to content

Commit

Permalink
make Option public, and rename SetOptions to Apply
Browse files Browse the repository at this point in the history
  • Loading branch information
methane committed Feb 26, 2024
1 parent 5f2654f commit e42533e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dsn.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ type Config struct {

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

// NewConfig creates a new Config and sets default values.
func NewConfig() *Config {
Expand All @@ -92,7 +92,7 @@ func NewConfig() *Config {
return cfg
}

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

// TimeTruncate sets the time duration to truncate time.Time values in
// query parameters.
func TimeTruncate(d time.Duration) option {
func TimeTruncate(d time.Duration) Option {
return func(cfg *Config) error {
cfg.timeTruncate = d
return nil
Expand Down

0 comments on commit e42533e

Please sign in to comment.