diff --git a/dbx/pg/config.go b/dbx/pg/config.go index 92d06e1..c4604e7 100644 --- a/dbx/pg/config.go +++ b/dbx/pg/config.go @@ -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 diff --git a/dbx/pg/config_test.go b/dbx/pg/config_test.go index 4a156ba..ce91c25 100644 --- a/dbx/pg/config_test.go +++ b/dbx/pg/config_test.go @@ -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",