28 lines
599 B
Go
28 lines
599 B
Go
package db
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/jackc/pgx/v5/pgxpool"
|
|
)
|
|
|
|
type Store interface {
|
|
Querier
|
|
CreateUserTx(ctx context.Context, arg CreateUserTxParams) (CreateUserTxResult, error)
|
|
VerifyEmailTx(ctx context.Context, arg VerifyEmailTxParams) (VerifyEmailTxResult, error)
|
|
}
|
|
|
|
// PostgresStore provides all functions to execute db queries and transactions
|
|
type PostgresStore struct {
|
|
*Queries
|
|
connPool *pgxpool.Pool
|
|
}
|
|
|
|
// NewPostgresStore creates a new Store
|
|
func NewPostgresStore(connPool *pgxpool.Pool) Store {
|
|
return &PostgresStore{
|
|
connPool: connPool,
|
|
Queries: New(connPool),
|
|
}
|
|
}
|