Skip to content

Adding more SQL function definition #9

@allwefantasy

Description

@allwefantasy

sql-code-intelligence provides more accurate and detailed information for function completion. However, in order to achieve this, we need function definition in SQL.
sql-code-intelligence has a mechanism that enables engineers to do this job.

For example, you can register split function in this project like the following:

class Splitter extends FuncReg {

  override def register = {
    val func = MLSQLSQLFunction.apply("split").
      funcParam.
      param("str", DataType.STRING, false, Map("zhDoc" -> "待切割字符")).
      param("pattern", DataType.STRING, false, Map("zhDoc" -> "分隔符")).
      func.
      returnParam(DataType.ARRAY, true, Map(
        "zhDoc" ->
          """
            |split函数。用于切割字符串,返回字符串数组
            |""".stripMargin
      )).
      build
    func
  }

}

Then you can put this class under the package tech.mlsql.autosuggest.funcs.
They will be autoloaded at system startup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions