mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2026-05-26 06:00:19 +00:00
📝 Add docstrings to feat/pgsql-driver
Docstrings generation was requested by @scottmckendry. * https://github.com/tinyauthapp/tinyauth/pull/892#issuecomment-4524261246 The following files were modified: * `internal/repository/postgres/db.go` * `internal/repository/postgres/store.go`
This commit is contained in:
committed by
GitHub
parent
40540ce133
commit
f5b9d83360
@@ -14,7 +14,7 @@ type Store struct {
|
||||
q *Queries
|
||||
}
|
||||
|
||||
// NewStore wraps a *Queries to satisfy repository.Store.
|
||||
// NewStore returns a repository.Store backed by the provided *Queries.
|
||||
func NewStore(q *Queries) repository.Store {
|
||||
return &Store{q: q}
|
||||
}
|
||||
@@ -23,6 +23,8 @@ var errorMap = map[error]error{
|
||||
sql.ErrNoRows: repository.ErrNotFound,
|
||||
}
|
||||
|
||||
// mapErr maps known database errors to repository-level errors using the package-level errorMap.
|
||||
// It uses errors.Is to match (so wrapped errors are recognized) and returns the original error if no mapping applies.
|
||||
func mapErr(err error) error {
|
||||
for from, to := range errorMap {
|
||||
if errors.Is(err, from) {
|
||||
|
||||
Reference in New Issue
Block a user