account page stubbed: link to etsy sign up
This commit is contained in:
@@ -31,30 +31,10 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
func NewStore(ctx context.Context) (*Store, error) {
|
||||
pool, err := newPool(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func NewStore(db *pgxpool.Pool) *Store {
|
||||
return &Store{
|
||||
db: pool,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func newPool(ctx context.Context) (*pgxpool.Pool, error) {
|
||||
pool, err := pgxpool.New(ctx, "postgres://app_client:app_password@localhost:5432/inventory_2?sslmode=disable")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create database client: %w", err)
|
||||
db: db,
|
||||
}
|
||||
|
||||
conn, err := pool.Acquire(ctx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create a database connection: %w", err)
|
||||
}
|
||||
conn.Release()
|
||||
|
||||
return pool, nil
|
||||
}
|
||||
|
||||
func (db *Store) WithContext(ctx context.Context) *StoreWithContext {
|
||||
|
||||
Reference in New Issue
Block a user