重构: 根目录 resource.go 精简,res_event.go 替换为 res_watcher.go,新增 di.go
resource.go 只保留跟 base 包无关的部分接口定义。res_event.go(旧资源事件接口)删除,替换成 res_watcher.go(ResWatcher 相关接口)。新增 di.go,提供依赖注入相关的公共辅助函数。
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package contracts
|
||||
|
||||
import (
|
||||
"git.fsdpf.net/go/req/resx"
|
||||
)
|
||||
|
||||
// ResEventType 资源操作类型:读(SELECT)+ 写(INSERT/UPDATE/DELETE)
|
||||
type ResEventType = resx.ResEventType
|
||||
|
||||
const (
|
||||
ResEventSelect = resx.ResEventSelect
|
||||
ResEventInsert = resx.ResEventInsert
|
||||
ResEventUpdate = resx.ResEventUpdate
|
||||
ResEventDelete = resx.ResEventDelete
|
||||
)
|
||||
|
||||
// ResChangeRow 描述一次资源写操作中某一行的变更内容
|
||||
type ResChangeRow = resx.ResChangeRow
|
||||
|
||||
// ResWatcher 关注一个或多个资源写操作的处理器,通过 _res_listener 注册表按资源绑定,
|
||||
// 每次事件触发都会重新构造实例(见 framework-v2 的 handler.ResWatcherBase / internal/resource 的
|
||||
// watcherDispatcher.getAppWatcher)
|
||||
type ResWatcher interface {
|
||||
Controller
|
||||
// Handle 处理一次资源变更,row 自带 User()
|
||||
Handle(row ResChangeRow) error
|
||||
GetCode() string
|
||||
}
|
||||
Reference in New Issue
Block a user