|
@@ -40,10 +40,6 @@ func Bind(app *application.App, simple *Simple) {
|
|
|
simple.bind(binder)
|
|
|
}
|
|
|
|
|
|
-type QueryRuleParseJsonBody struct {
|
|
|
- Rule string `json:"rule" assign:"-"`
|
|
|
-}
|
|
|
-
|
|
|
type AdvanceQueryParams interface {
|
|
|
GetRuleConditions() (string, []any)
|
|
|
GetPageNo() int
|
|
@@ -89,7 +85,7 @@ func (params *AddUseQueryRuleQueryRouteParams) check() error {
|
|
|
if params.DBSchema == "" {
|
|
|
return errors.New("没有传递DBSchema")
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if params.Object == nil {
|
|
|
return errors.New("没有传递Object")
|
|
|
}
|
|
@@ -248,6 +244,33 @@ func AddUseQueryRuleQueryRoute[O any](binder *binding.Binder, addParams *AddUseQ
|
|
|
},
|
|
|
}, addParams.QueryMiddlewares...)
|
|
|
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+type QueryRuleParseJsonBody struct {
|
|
|
+ Rule string `json:"rule" assign:"-"`
|
|
|
+}
|
|
|
+
|
|
|
+type AddUseQueryRuleParseRouteParams struct {
|
|
|
+ Object domain.Object
|
|
|
+}
|
|
|
+
|
|
|
+func (params *AddUseQueryRuleParseRouteParams) check() error {
|
|
|
+ if params.Object == nil {
|
|
|
+ return errors.New("没有传递Object")
|
|
|
+ }
|
|
|
+
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+func AddUseQueryRuleParseRoute(binder *binding.Binder, addParams *AddUseQueryRuleParseRouteParams) error {
|
|
|
+ err := addParams.check()
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
+ domainPath := domain.RelativeDomainPath(addParams.Object)
|
|
|
+
|
|
|
binding.PostBind(binder, &binding.SimpleBindItem[map[string]any]{
|
|
|
Path: domainPath + "/queryRule/parse",
|
|
|
SendResponseFunc: response.SendMapResponse,
|