package base // ResWatcher 描述一条"资源写操作监听"注册记录:Code 对应一个实现了 contracts.ResWatcher 的处理器, // ResourceUuids 是它关心的资源(支持 1-n 个) type ResWatcher struct { Uuid string `db:"uuid"` Code string `db:"code"` Name string `db:"name"` ResourceUuids []string `db:"resource_uuid"` OwnedUser string `db:"owned_user"` // Handle 执行时使用的用户身份(同 Cron/Mqtt 约定) MaxDepth int `db:"max_depth"` // 允许级联触发的最大深度,用于防止 watcher 之间循环触发 UpdatedAt string `db:"updated_at"` CreatedAt string `db:"created_at"` } // GetResWatcher 按 code 查询单条 ResWatcher 注册记录 type GetResWatcher func(code string) (ResWatcher, bool) // GetResWatchers 按资源 uuid 反查关心该资源的 ResWatcher 注册记录 type GetResWatchers func(resourceUuid string) []ResWatcher