Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
27158d69
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
27158d69
编写于
6月 13, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into feat/tsdb_refact
上级
b2c147be
03eca307
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
51 addition
and
4 deletion
+51
-4
docs/examples/.gitignre
docs/examples/.gitignre
+0
-2
docs/examples/go/insert/sql/main.go
docs/examples/go/insert/sql/main.go
+49
-0
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+2
-2
未找到文件。
docs/examples/.gitignre
已删除
100644 → 0
浏览文件 @
b2c147be
.vscode
*.lock
\ No newline at end of file
docs/examples/go/insert/sql/main.go
0 → 100644
浏览文件 @
27158d69
package
main
import
(
"database/sql"
"fmt"
_
"github.com/taosdata/driver-go/v2/taosRestful"
)
func
createStable
(
taos
*
sql
.
DB
)
{
_
,
err
:=
taos
.
Exec
(
"CREATE DATABASE power"
)
if
err
!=
nil
{
fmt
.
Println
(
"failed to create database, err:"
,
err
)
}
_
,
err
=
taos
.
Exec
(
"CREATE STABLE power.meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)"
)
if
err
!=
nil
{
fmt
.
Println
(
"failed to create stable, err:"
,
err
)
}
}
func
insertData
(
taos
*
sql
.
DB
)
{
sql
:=
`INSERT INTO power.d1001 USING power.meters TAGS(California.SanFrancisco, 2) VALUES ('2018-10-03 14:38:05.000', 10.30000, 219, 0.31000) ('2018-10-03 14:38:15.000', 12.60000, 218, 0.33000) ('2018-10-03 14:38:16.800', 12.30000, 221, 0.31000)
power.d1002 USING power.meters TAGS(California.SanFrancisco, 3) VALUES ('2018-10-03 14:38:16.650', 10.30000, 218, 0.25000)
power.d1003 USING power.meters TAGS(California.LosAngeles, 2) VALUES ('2018-10-03 14:38:05.500', 11.80000, 221, 0.28000) ('2018-10-03 14:38:16.600', 13.40000, 223, 0.29000)
power.d1004 USING power.meters TAGS(California.LosAngeles, 3) VALUES ('2018-10-03 14:38:05.000', 10.80000, 223, 0.29000) ('2018-10-03 14:38:06.500', 11.50000, 221, 0.35000)`
result
,
err
:=
taos
.
Exec
(
sql
)
if
err
!=
nil
{
fmt
.
Println
(
"failed to insert, err:"
,
err
)
return
}
rowsAffected
,
err
:=
result
.
RowsAffected
()
if
err
!=
nil
{
fmt
.
Println
(
"failed to get affected rows, err:"
,
err
)
return
}
fmt
.
Println
(
"RowsAffected"
,
rowsAffected
)
}
func
main
()
{
var
taosDSN
=
"root:taosdata@http(localhost:6041)/"
taos
,
err
:=
sql
.
Open
(
"taosRestful"
,
taosDSN
)
if
err
!=
nil
{
fmt
.
Println
(
"failed to connect TDengine, err:"
,
err
)
return
}
defer
taos
.
Close
()
createStable
(
taos
)
insertData
(
taos
)
}
source/libs/function/src/builtins.c
浏览文件 @
27158d69
...
...
@@ -1656,8 +1656,8 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.
finalizeFunc
=
elapsedFinalize
,
.
invertFunc
=
NULL
,
.
combineFunc
=
elapsedCombine
,
.
pPartialFunc
=
"_elapsed_partial"
,
.
pMergeFunc
=
"_elapsed_merge"
//
.pPartialFunc = "_elapsed_partial",
//
.pMergeFunc = "_elapsed_merge"
},
{
.
name
=
"_elapsed_partial"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录