20 lines
421 B
Go
20 lines
421 B
Go
|
package engine
|
||
|
|
||
|
import (
|
||
|
"git.fsdpf.net/go/contracts"
|
||
|
"git.fsdpf.net/go/db"
|
||
|
)
|
||
|
|
||
|
type EngineCase[T any] struct {
|
||
|
predicate contracts.Condition
|
||
|
cb func(data T, g contracts.GlobalParams) error
|
||
|
}
|
||
|
|
||
|
func (this EngineCase[T]) ToSql(param contracts.ModelParam) db.Expression {
|
||
|
return this.predicate.ToSql(param)
|
||
|
}
|
||
|
|
||
|
func (this EngineCase[T]) Execute(data T, g contracts.GlobalParams) error {
|
||
|
return this.cb(data, g)
|
||
|
}
|