update
This commit is contained in:
12
internal/repository/errors.go
Normal file
12
internal/repository/errors.go
Normal file
@ -0,0 +1,12 @@
|
||||
// Package repository 数据访问层:封装全部 SQL / GORM 细节。
|
||||
//
|
||||
// 分层约定:
|
||||
// - 只有本层可以感知 *gorm.DB 与表结构;service 与 handler 不得直接触碰数据库。
|
||||
// - 对外只暴露接口 + 构造函数,便于在测试中替换实现。
|
||||
// - 数据库错误在此层归一化为本包的 sentinel error,避免 gorm 错误类型向上层泄漏。
|
||||
package repository
|
||||
|
||||
import "errors"
|
||||
|
||||
// ErrNotFound 记录不存在。
|
||||
var ErrNotFound = errors.New("record not found")
|
||||
Reference in New Issue
Block a user