跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[Go 编程语言] 有大佬用 go 操作 doris 吗?问个入门问题

发表于

使用 xorm 和 gorm 操作 doris2.0 都不成功,看文档没有说支持 doris ,但是 doris 本身应该高度兼容 mysql 的吧,这些 orm 框架这么严格?还是代码上有问题?

xorm code:

func SelectAd() {
	engine := _init_db("10.22.xx", "9030", "abc")

	ad := new(FlowAdUrlStat)
	if _, err := engine.Where("opt_YYYYMMDD=?", 20240626).Get(ad); err != nil {
		log.Fatal(err)
	}

	fmt.Println(ad)
}

报错: 2024/06/27 10:55:37 Error 1105 (HY000): errCode = 2, detailMessage = Only support prepare SelectStmt point query now

gorm code:

	var ad FlowAdUrlStat

	stmt := db.Session(&gorm.Session{DryRun: true}).Where("opt_YYYYMMDD = ?", 20240626).Take(&ad).Statement
	fmt.Println(stmt.SQL.String()) 
	fmt.Println(stmt.Vars)         

	if err := db.Where("opt_YYYYMMDD = ?", 20240626).Take(&ad).Error; err != nil {
		log.Fatal(err)
	}

	fmt.Println(ad)

报错:

output:

Type 'dlv help' for list of commands.
SELECT * FROM flow_ad_url_stat WHERE opt_YYYYMMDD = ? LIMIT ?
[20240626 1]
2024/06/26 18:07:03 Error 1105 (HY000): errCode = 2, detailMessage = Syntax error in line 1:
...RE opt_YYYYMMDD = ? LIMIT ?
^
Encountered: ?
Expected

2024/06/26 18:07:03 D:/goproject/cloudsvc/dbutils/mysqlutil.go:63 Error 1105 (HY000): errCode = 2, detailMessage = Syntax error in line 1:
...RE opt_YYYYMMDD = ? LIMIT ?
^
Encountered: ?
Expected

[58.356ms] [rows:0] SELECT * FROM flow_ad_url_stat WHERE opt_YYYYMMDD = 20240626 LIMIT 1
Process 48512 has exited with status 1
Detaching

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.