提交 2b1ac2ac 编写于 作者: D dingbo

docs: connect go

上级 fa4f2c38
...@@ -12,12 +12,13 @@ func main() { ...@@ -12,12 +12,13 @@ func main() {
dsn := os.Getenv("TDENGINE_GO_DSN") dsn := os.Getenv("TDENGINE_GO_DSN")
taos, err := sql.Open("taosRestful", dsn) taos, err := sql.Open("taosRestful", dsn)
if err != nil { if err != nil {
fmt.Println("failed to connect TDengine, err:", err) fmt.Println(err)
return return
} }
_, err = taos.Exec("select server_version()") _, err = taos.Query("select server_version()")
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
return
} }
fmt.Println("connect success") fmt.Println("connect success")
defer taos.Close() defer taos.Close()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册