Files
contracts/res_watcher.go
what e14aee1498 重构: 根目录 resource.go 精简,res_event.go 替换为 res_watcher.go,新增 di.go
resource.go 只保留跟 base 包无关的部分接口定义。res_event.go(旧资源事件接口)删除,替换成 res_watcher.go(ResWatcher 相关接口)。新增 di.go,提供依赖注入相关的公共辅助函数。
2026-07-22 09:14:22 +08:00

29 lines
872 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 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
}