feat: add Go password session lifecycle
This commit is contained in:
@@ -56,20 +56,36 @@ type Querier interface {
|
||||
Query(context.Context, string, ...any) (Rows, error)
|
||||
}
|
||||
|
||||
type Transaction interface {
|
||||
Querier
|
||||
Exec(context.Context, string, ...any) error
|
||||
Commit(context.Context) error
|
||||
Rollback(context.Context) error
|
||||
}
|
||||
|
||||
type TransactionBeginner interface {
|
||||
Begin(context.Context) (Transaction, error)
|
||||
}
|
||||
|
||||
type Pool interface {
|
||||
Querier
|
||||
Close()
|
||||
}
|
||||
|
||||
type Database struct {
|
||||
config Config
|
||||
querier Querier
|
||||
config Config
|
||||
querier Querier
|
||||
transactions TransactionBeginner
|
||||
}
|
||||
|
||||
type Store = Database
|
||||
|
||||
func NewDatabase(config Config, querier Querier) *Database {
|
||||
return &Database{config: config, querier: querier}
|
||||
db := &Database{config: config, querier: querier}
|
||||
if transactions, ok := querier.(TransactionBeginner); ok {
|
||||
db.transactions = transactions
|
||||
}
|
||||
return db
|
||||
}
|
||||
|
||||
func (db *Database) Readiness(ctx context.Context) error {
|
||||
|
||||
Reference in New Issue
Block a user