Documentation
¶
Index ¶
- func IsAccessDenied(err error) bool
- func IsAlreadyExists(err error) bool
- func IsConflict(err error) bool
- func IsNotFound(err error) bool
- func NewQuery() *repository.Query
- type BaseRepository
- type BusinessError
- func NewAccessDenied(reason string) *BusinessError
- func NewConflict(resource string) *BusinessError
- func NewDatabaseError(operation string, err error) *BusinessError
- func NewInternal(message string) *BusinessError
- func NewInvalidInput(field string, reason string) *BusinessError
- func NewNotFound(resource string) *BusinessError
- type ErrorCode
- type Filter
- func Between(field string, min, max interface{}) *Filter
- func Eq(field string, value interface{}) *Filter
- func Gt(field string, value interface{}) *Filter
- func Gte(field string, value interface{}) *Filter
- func In(field string, values ...interface{}) *Filter
- func Like(field string, value string) *Filter
- func Lt(field string, value interface{}) *Filter
- func Lte(field string, value interface{}) *Filter
- func Neq(field string, value interface{}) *Filter
- type Handler
- type Logger
- type Order
- type Paging
- type Query
- type Repository
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BaseRepository ¶
type BaseRepository[T any] = repository.BaseRepository[T]
BaseRepository - 基础仓储实现
type BusinessError ¶
BusinessError - 业务错误
func NewAccessDenied ¶
func NewAccessDenied(reason string) *BusinessError
NewAccessDenied - 创建访问拒绝错误
func NewDatabaseError ¶
func NewDatabaseError(operation string, err error) *BusinessError
NewDatabaseError - 创建数据库错误
func NewInvalidInput ¶
func NewInvalidInput(field string, reason string) *BusinessError
NewInvalidInput - 创建无效输入错误
type Handler ¶
Handler - 数据库处理器接口
func NewGormHandler ¶
func NewGormHandler(gormDB interface{}) Handler
NewGormHandler - 创建 GORM 处理器 需要导入 gorm,从 gorm.DB 创建处理器
type Repository ¶
type Repository[T any] = repository.Repository[T]
Repository - 通用仓储接口
func NewBaseRepository ¶
func NewBaseRepository[T any](handler Handler, tableName string) Repository[T]
NewBaseRepository - 创建基础仓储
Click to show internal directories.
Click to hide internal directories.