feat(ports): define consumer-side interfaces, sentinel errors, IsUniqueViolation

This commit is contained in:
2026-09-14 19:47:27 +08:00
parent f99f5a7878
commit 0c3b34c184
3 changed files with 126 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
package ports
import (
"errors"
"booklib/internal/store"
)
// Re-export sentinel errors so handlers can use errors.Is via ports.
var (
ErrLastAdmin = store.ErrLastAdmin
ErrUniqueViolation = store.ErrUniqueViolation
)
// IsUniqueViolation consolidates the pg 23505 check into a single predicate.
func IsUniqueViolation(err error) bool { return store.IsUniqueViolation(err) }
// Upload sentinel errors.
var (
ErrTooLarge = errors.New("file too large")
ErrIncomplete = errors.New("upload incomplete")
ErrSizeMismatch = errors.New("size mismatch")
ErrNotFound = errors.New("not found")
)