Files

16 lines
708 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Package repository 数据访问层:封装全部 SQL / GORM 细节。
//
// 分层约定:
// - 只有本层可以感知 *gorm.DB 与表结构;service 与 handler 不得直接触碰数据库。
// - 对外只暴露接口 + 构造函数,便于在测试中替换实现。
// - 数据库错误在此层归一化为本包的 sentinel error,避免 gorm 错误类型向上层泄漏。
package repository
import "errors"
// ErrNotFound 记录不存在。
var ErrNotFound = errors.New("record not found")
// ErrInvalidImageGroup 主副图分组操作不合法:主图不存在 / 不属于该草稿 / 自身不是主图 / 空集合。
var ErrInvalidImageGroup = errors.New("invalid image group")