代码拉取完成,页面将自动刷新
package eocontext
import "gitee.com/meng_mengs_boys/eosc/utils/config"
var (
FilterSkillName = config.TypeNameOf((*IFilter)(nil))
)
type IFilter interface {
DoFilter(ctx EoContext, next IChain) (err error)
Destroy()
}
type IChain interface {
DoChain(ctx EoContext) error
Destroy()
}
type IChainPro interface {
Destroy()
Chain(ctx EoContext, append ...IFilter) error
}
type Filters []IFilter
func (fs Filters) DoChain(ctx EoContext) error {
if len(fs) > 0 {
f := fs[0]
next := fs[1:]
return f.DoFilter(ctx, next)
}
//ctx.GetComplete().Complete(ctx)
return nil
}
func (fs Filters) Destroy() {
for _, f := range fs {
f.Destroy()
}
}
func DoChain(ctx EoContext, orgfilter Filters, append ...IFilter) error {
fs := orgfilter
fl := len(fs)
al := len(append)
if fl == 0 && al == 0 {
return nil
}
if fl == 0 {
return Filters(append).DoChain(ctx)
}
if al == 0 {
return fs.DoChain(ctx)
}
tp := make(Filters, fl+al)
copy(tp, fs)
copy(tp[fl:], append)
return tp.DoChain(ctx)
}
type _FilterChain struct {
chain IChain
}
func (c *_FilterChain) DoFilter(ctx EoContext, next IChain) (err error) {
return c.chain.DoChain(ctx)
}
func (c *_FilterChain) Destroy() {
c.chain.Destroy()
}
func ToFilter(chain IChain) IFilter {
return &_FilterChain{chain: chain}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。