[feat] 依赖调整 git.fsdpf.net/go/contracts => git.fsdpf.net/go/req
This commit is contained in:
+9
-9
@@ -6,9 +6,9 @@ import (
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"git.fsdpf.net/go/contracts"
|
||||
"git.fsdpf.net/go/contracts/support"
|
||||
"git.fsdpf.net/go/condition/contracts"
|
||||
"git.fsdpf.net/go/db"
|
||||
"git.fsdpf.net/go/req"
|
||||
"github.com/samber/lo"
|
||||
"github.com/spf13/cast"
|
||||
)
|
||||
@@ -33,8 +33,8 @@ func init() {
|
||||
type Engine[T any] struct {
|
||||
code string
|
||||
opts engineOptions
|
||||
g contracts.GlobalParams
|
||||
def func(data T, g contracts.GlobalParams) error
|
||||
g req.GlobalParams
|
||||
def func(data T, g req.GlobalParams) error
|
||||
predicates []*EngineCase[T]
|
||||
}
|
||||
|
||||
@@ -43,18 +43,18 @@ func (this Engine[T]) GetCode() string {
|
||||
}
|
||||
|
||||
// 公共参数
|
||||
func (this *Engine[T]) SetGlobalParams(g contracts.GlobalParams) *Engine[T] {
|
||||
func (this *Engine[T]) SetGlobalParams(g req.GlobalParams) *Engine[T] {
|
||||
this.g = g
|
||||
return this
|
||||
}
|
||||
|
||||
func (this *Engine[T]) Case(cond contracts.Condition, cb func(data T, g contracts.GlobalParams) error) *Engine[T] {
|
||||
func (this *Engine[T]) Case(cond contracts.Condition, cb func(data T, g req.GlobalParams) error) *Engine[T] {
|
||||
this.predicates = append(this.predicates, &EngineCase[T]{cond, cb})
|
||||
return this
|
||||
}
|
||||
|
||||
// 基础条件
|
||||
func (this *Engine[T]) Default(cb func(data T, g contracts.GlobalParams) error) *Engine[T] {
|
||||
func (this *Engine[T]) Default(cb func(data T, g req.GlobalParams) error) *Engine[T] {
|
||||
this.def = cb
|
||||
return this
|
||||
}
|
||||
@@ -169,7 +169,7 @@ func (this *Engine[T]) Execute(data T) error {
|
||||
}
|
||||
|
||||
if this.g == nil {
|
||||
this.g = support.NewGlobalParam(`{}`, nil)
|
||||
this.g = req.NewGlobalParam(`{}`, nil)
|
||||
}
|
||||
|
||||
param := &EngineParam{this.g}
|
||||
@@ -220,6 +220,6 @@ func New[T any](table string, opt ...EngineOption) *Engine[T] {
|
||||
return &Engine[T]{
|
||||
code: table,
|
||||
opts: opts,
|
||||
g: support.NewGlobalParam("", nil),
|
||||
g: req.NewGlobalParam("", nil),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user