Skip to content

Commit

Permalink
bug: config reference
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie authored Nov 20, 2024
1 parent cf55523 commit 4d9631c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions dbx/pg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ const (

// Context returns a new Context that carries the provided Config.
func (cfg *Config) Context(ctx context.Context) context.Context {
return context.WithValue(ctx, configKey, cfg)
return context.WithValue(ctx, configKey, *cfg)
}

// FromContext will return the Config carried in the provided Context.
//
// It panics if config is not available on the current context.
func FromContext(ctx context.Context) Config {
return ctx.Value(configKey).(Config)
func FromContext(ctx context.Context) *Config {
return ctx.Value(configKey).(*Config)
}

// Config represents configuration for PostgreSQL connection
Expand Down
2 changes: 1 addition & 1 deletion dbx/pg/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestFormatDSN(t *testing.T) {
func TestContext(t *testing.T) {
t.Parallel()

config := pg.Config{
config := &pg.Config{
Database: "test_db",
Host: "localhost",
Password: "password",
Expand Down

0 comments on commit 4d9631c

Please sign in to comment.