Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【设计探讨】嵌套规则为何用额外的 sql/params 关键词与 #{} 语法? #26

Open
nobodxbodon opened this issue Nov 3, 2023 · 0 comments

Comments

@nobodxbodon
Copy link

如果设计成使用顶层的 main/规则名,是否能达到同样目的?

如首页例子:

{
  "main": "必填, 代码从这里开始生成, 用 @规则名() 引用其他语句",
  "规则名": "可以编写任意 SQL 语句 @规则名2() @动态传参(a = 求给 ||| b = star)",
  "规则名2": {
    "sql": "用 #{参数名} 指定可被替换的值",
    "params": {
      "参数名": "在 params 中指定静态参数, 会优先被替换"
    }
  },
  "动态传参": "#{a}鱼皮#{b}"
}

可否设计成:

{
  "main": "必填, 代码从这里开始生成, 用 @规则名() 引用其他语句",
  "规则名": "可以编写任意 SQL 语句 @规则名2() @动态传参(a = 求给 ||| b = star)",
  "规则名2": {
    "main": "用 @参数名() 指定可被替换的值",
    "参数名": "在 params 中指定静态参数, 会优先被替换"
  },
  "动态传参": "#{a}鱼皮#{b}"
}
@nobodxbodon nobodxbodon changed the title 【设计探讨】嵌套规则为何用额外的 sql/params 关键词? 【设计探讨】嵌套规则为何用额外的 sql/params 关键词与 #{} 语法? Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant