Jelajahi Sumber

fix(docs): fix docs build error

Signed-off-by: Red-Asuka <liyd0623@gmail.com>
Red-Asuka 3 tahun lalu
induk
melakukan
f9fcc563c5
2 mengubah file dengan 53 tambahan dan 44 penghapusan
  1. 23 20
      docs/en_US/rules/sources/plugin/sql.md
  2. 30 24
      docs/zh_CN/rules/sources/plugin/sql.md

+ 23 - 20
docs/en_US/rules/sources/plugin/sql.md

@@ -8,9 +8,10 @@ This plugin must be used in conjunction with at least a database driver. We are
 This [repository](https://github.com/lf-edge/ekuiper/tree/master/extensions/sqldatabase/driver) lists all the supported drivers.  
 
 This plugin supports `sqlserver\postgres\mysql\sqlite3\oracle` drivers by default. User can compile plugin that only support one driver by himself,
-for example, if he only wants sqlserver, then he can build with build tag `sqlserver`. 
+for example, if he only wants sqlserver, then he can build with build tag `sqlserver`.
 
 ### Default build command
+
 ```shell
 # cd $eKuiper_src
 # go build -trimpath -modfile extensions.mod --buildmode=plugin -o plugins/sources/Sql.so extensions/sources/sql/sql.go
@@ -18,6 +19,7 @@ for example, if he only wants sqlserver, then he can build with build tag `sqlse
 ```
 
 ### Sqlserver build command
+
 ```shell
 # cd $eKuiper_src
 # go build -trimpath -modfile extensions.mod --buildmode=plugin -tags sqlserver -o plugins/sources/Sql.so extensions/sources/sql/sql.go
@@ -58,6 +60,7 @@ template_config:
     indexFieldType: "DATETIME"
     dateTimeFormat: "YYYY-MM-dd HH:mm:ssSSS"
 ```
+
 ### Global configurations
 
 User can specify the global sql source settings here. The configuration items specified in `default` section will be taken as default settings for the source when running this source.
@@ -71,14 +74,15 @@ The interval (ms) to issue a query.
 The target database url
 
 | database   | url sample                                            |
-|------------|-------------------------------------------------------|
+| ---------- | ----------------------------------------------------- |
 | mysql      | mysql://user:test@140.210.204.147/user?parseTime=true |
-| sql server | sqlserver://username:password@140.210.204.147/testdb  |          
+| sql server | sqlserver://username:password@140.210.204.147/testdb  |
 | postgres   | postgres://user:pass@localhost/dbname                 |
 | postgres   | postgres://user:pass@localhost/dbname                 |
 | sqlite     | sqlite:/path/to/file.db                               |
 
 ### internalSqlQueryCfg
+
 * `table`: table name to query
 * `limit`: how many items need fetch from the result
 * `indexField`: which column for the table act as index to record the offset
@@ -86,29 +90,29 @@ The target database url
 * `indexFieldType`: column type for the indexField, if it is dateTime type, must set this field with `DATETIME`
 * `dateTimeFormat`: data time format for the index field
 
-
-| table    | limit | indexField   | indexValue            | indexFieldType  | dateTimeFormat              | sql query statement                                                                                 |
-|----------|-------|--------------|-----------------------|-----------------|-----------------------------|-----------------------------------------------------------------------------------------------------|
-| Student  | 10    |              |                       |                 |                             | select * from Student limit 10                                                                      |
-| Student  | 10    | stun         | 100                   |                 |                             | select * from Student where stun > 100 limit 10                                                     |          
-| Student  | 10    | registerTime | "2022-04-21 10:23:55" | "DATETIME"      |    "YYYY-MM-dd HH:mm:ss"    | select * from Student where registerTime > '2022-04-21 10:23:55' order by registerTime ASC limit 10 |
-
+| table   | limit | indexField   | indexValue            | indexFieldType | dateTimeFormat        | sql query statement                                                                                 |
+| ------- | ----- | ------------ | --------------------- | -------------- | --------------------- | --------------------------------------------------------------------------------------------------- |
+| Student | 10    |              |                       |                |                       | select * from Student limit 10                                                                      |
+| Student | 10    | stun         | 100                   |                |                       | select * from Student where stun > 100 limit 10                                                     |
+| Student | 10    | registerTime | "2022-04-21 10:23:55" | "DATETIME"     | "YYYY-MM-dd HH:mm:ss" | select * from Student where registerTime > '2022-04-21 10:23:55' order by registerTime ASC limit 10 |
 
 ### templateSqlQueryCfg
+
 * `TemplateSql`: sql statement template
 * `indexField`: which column for the table act as index to record the offset
 * `indexValue`: initial index value, if user specify this field, the query will use this initial value as query condition, will update next query when get a greater value.
 * `indexFieldType`: column type for the indexField, if it is dateTime type, must set this field with `DATETIME`
 * `dateTimeFormat`: data time format for the index field
 
+::: v-pre
+| TemplateSql                                                                                       | indexField   | indexValue            | indexFieldType | dateTimeFormat        | sql query statement                                                                                 |
+| ------------------------------------------------------------------------------------------------- | ------------ | --------------------- | -------------- | --------------------- | --------------------------------------------------------------------------------------------------- |
+| select * from Student limit 10                                                                    |              |                       |                |                       | select * from Student limit 10                                                                      |
+| select * from Student where stun > {{.stun}} limit 10                                             | stun         | 100                   |                |                       | select * from Student where stun > 100 limit 10                                                     |
+| select * from Student where registerTime > '{{.registerTime}}' order by registerTime ASC limit 10 | registerTime | "2022-04-21 10:23:55" | "DATETIME"     | "YYYY-MM-dd HH:mm:ss" | select * from Student where registerTime > '2022-04-21 10:23:55' order by registerTime ASC limit 10 |
+:::
 
-| TemplateSql                                                                                       | indexField   | indexValue            | indexFieldType  | dateTimeFormat              | sql query statement                                                                                 |
-|---------------------------------------------------------------------------------------------------|--------------|-----------------------|-----------------|-----------------------------|-----------------------------------------------------------------------------------------------------|
-| select * from Student limit 10                                                                    |              |                       |                 |                             | select * from Student limit 10                                                                      |
-| select * from Student where stun > {{.stun}} limit 10                                             | stun         | 100                   |                 |                             | select * from Student where stun > 100 limit 10                                                     |          
-| select * from Student where registerTime > '{{.registerTime}}' order by registerTime ASC limit 10 | registerTime | "2022-04-21 10:23:55" | "DATETIME"      |    "YYYY-MM-dd HH:mm:ss"    | select * from Student where registerTime > '2022-04-21 10:23:55' order by registerTime ASC limit 10 |
-
-### *Note*: users only need set internalSqlQueryCfg or templateSqlQueryCfg, if both set, templateSqlQueryCfg will be used 
+### *Note*: users only need set internalSqlQueryCfg or templateSqlQueryCfg, if both set, templateSqlQueryCfg will be used
 
 ## Override the default settings
 
@@ -118,9 +122,8 @@ If you have a specific connection that need to overwrite the default settings, y
 
 ```
 demo (
-		...
-	) WITH (DATASOURCE="demo", FORMAT="JSON", CONF_KEY="template_config", TYPE="sql");
+  ...
+ ) WITH (DATASOURCE="demo", FORMAT="JSON", CONF_KEY="template_config", TYPE="sql");
 ```
 
 The configuration keys "template_config" will be used.
-

+ 30 - 24
docs/zh_CN/rules/sources/plugin/sql.md

@@ -1,13 +1,15 @@
-## Sql 源
- 
+# Sql 源
+
 源将定期查询数据库以获取数据流。
 
 ## 编译和部署插件
+
 此插件必须与至少一个数据库驱动程序一起使用。我们使用构建标签来确定将包含哪个驱动程序。[此处](https://github.com/lf-edge/ekuiper/tree/master/extensions/sqldatabase/driver)列出了所有支持的驱动程序。
 
 该插件默认支持 `sqlserver\postgres\mysql\sqlite3\oracle` 驱动。用户可以自己编译只支持一个驱动的插件,例如如果他只想要sqlserver,那么他可以用 build tag sqlserver 构建。
 
-### 默认构建命令 
+### 默认构建命令
+
 ```shell
 # cd $eKuiper_src
 # go build -trimpath -modfile extensions.mod --buildmode=plugin -o plugins/sources/Sql.so extensions/sources/sql/sql.go
@@ -15,6 +17,7 @@
 ```
 
 ### Sqlserver 构建命令
+
 ```shell
 # cd $eKuiper_src
 # go build -trimpath -modfile extensions.mod --buildmode=plugin -tags sqlserver -o plugins/sources/Sql.so extensions/sources/sql/sql.go
@@ -55,6 +58,7 @@ template_config:
     indexFieldType: "DATETIME"
     dateTimeFormat: "YYYY-MM-dd HH:mm:ssSSS"
 ```
+
 ### 全局配置
 
 用户可以在此处指定全局 sql 源设置。 `default` 部分中指定的配置项将在运行此源时作为源的默认设置。
@@ -68,42 +72,43 @@ template_config:
 目标数据库地址
 
 | database   | url sample                                            |
-|------------|-------------------------------------------------------|
+| ---------- | ----------------------------------------------------- |
 | mysql      | mysql://user:test@140.210.204.147/user?parseTime=true |
-| sql server | sqlserver://username:password@140.210.204.147/testdb  |          
+| sql server | sqlserver://username:password@140.210.204.147/testdb  |
 | postgres   | postgres://user:pass@localhost/dbname                 |
 | postgres   | postgres://user:pass@localhost/dbname                 |
 | sqlite     | sqlite:/path/to/file.db                               |
 
 ### internalSqlQueryCfg
+
 * `table`: 要查询的表名
 * `limit`: 需要从结果中获取多少条目
 * `indexField`: 表的哪一列作为索引来记录偏移量
-* `indexValue`: 初始索引值,如果用户指定该字段,查询将使用这个初始值作为查询条件,当获得更大的值时将更新下一个查询 
-* `indexFieldType`: 索引字段的列类型,如果是dateTime类型,必须将该字段设置为`DATETIME` 
+* `indexValue`: 初始索引值,如果用户指定该字段,查询将使用这个初始值作为查询条件,当获得更大的值时将更新下一个查询
+* `indexFieldType`: 索引字段的列类型,如果是dateTime类型,必须将该字段设置为`DATETIME`
 * `dateTimeFormat`: 索引字段的时间格式
 
-
-| table    | limit | indexField   | indexValue            | indexFieldType  | dateTimeFormat              | sql query statement                                                                                 |
-|----------|-------|--------------|-----------------------|-----------------|-----------------------------|-----------------------------------------------------------------------------------------------------|
-| Student  | 10    |              |                       |                 |                             | select * from Student limit 10                                                                      |
-| Student  | 10    | stun         | 100                   |                 |                             | select * from Student where stun > 100 limit 10                                                     |          
-| Student  | 10    | registerTime | "2022-04-21 10:23:55" | "DATETIME"      |    "YYYY-MM-dd HH:mm:ss"    | select * from Student where registerTime > '2022-04-21 10:23:55' order by registerTime ASC limit 10 |
-
+| table   | limit | indexField   | indexValue            | indexFieldType | dateTimeFormat        | sql query statement                                                                                 |
+| ------- | ----- | ------------ | --------------------- | -------------- | --------------------- | --------------------------------------------------------------------------------------------------- |
+| Student | 10    |              |                       |                |                       | select * from Student limit 10                                                                      |
+| Student | 10    | stun         | 100                   |                |                       | select * from Student where stun > 100 limit 10                                                     |
+| Student | 10    | registerTime | "2022-04-21 10:23:55" | "DATETIME"     | "YYYY-MM-dd HH:mm:ss" | select * from Student where registerTime > '2022-04-21 10:23:55' order by registerTime ASC limit 10 |
 
 ### templateSqlQueryCfg
+
 * `TemplateSql`: sql语句模板
-* `indexField`: 表的哪一列作为索引来记录偏移量 
-* `indexValue`: 同上 
+* `indexField`: 表的哪一列作为索引来记录偏移量
+* `indexValue`: 同上
 * `indexFieldType`: 同上
 * `dateTimeFormat`: 同上
 
-
-| TemplateSql                                                                                       | indexField   | indexValue            | indexFieldType  | dateTimeFormat              | sql query statement                                                                                 |
-|---------------------------------------------------------------------------------------------------|--------------|-----------------------|-----------------|-----------------------------|-----------------------------------------------------------------------------------------------------|
-| select * from Student limit 10                                                                    |              |                       |                 |                             | select * from Student limit 10                                                                      |
-| select * from Student where stun > {{.stun}} limit 10                                             | stun         | 100                   |                 |                             | select * from Student where stun > 100 limit 10                                                     |          
-| select * from Student where registerTime > '{{.registerTime}}' order by registerTime ASC limit 10 | registerTime | "2022-04-21 10:23:55" | "DATETIME"      |    "YYYY-MM-dd HH:mm:ss"    | select * from Student where registerTime > '2022-04-21 10:23:55' order by registerTime ASC limit 10 |
+::: v-pre
+| TemplateSql                                                                                       | indexField   | indexValue            | indexFieldType | dateTimeFormat        | sql query statement                                                                                 |
+| ------------------------------------------------------------------------------------------------- | ------------ | --------------------- | -------------- | --------------------- | --------------------------------------------------------------------------------------------------- |
+| select * from Student limit 10                                                                    |              |                       |                |                       | select * from Student limit 10                                                                      |
+| select * from Student where stun > {{.stun}} limit 10                                             | stun         | 100                   |                |                       | select * from Student where stun > 100 limit 10                                                     |
+| select * from Student where registerTime > '{{.registerTime}}' order by registerTime ASC limit 10 | registerTime | "2022-04-21 10:23:55" | "DATETIME"     | "YYYY-MM-dd HH:mm:ss" | select * from Student where registerTime > '2022-04-21 10:23:55' order by registerTime ASC limit 10 |
+:::
 
 ### *注意*: 用户只需要设置 internalSqlQueryCfg 或 templateSqlQueryCfg,如果两者都设置,将使用 templateSqlQueryCfg
 
@@ -115,7 +120,8 @@ template_config:
 
 ```
 demo (
-		...
-	) WITH (DATASOURCE="demo", FORMAT="JSON", CONF_KEY="template_config", TYPE="sql");
+  ...
+ ) WITH (DATASOURCE="demo", FORMAT="JSON", CONF_KEY="template_config", TYPE="sql");
 ```
+
 将使用配置键 `template_config`