如何使用 gorm 包从 golang 调用 postgres 存储过程

Din*_*mar 5 postgresql go go-gorm

我正在开发一个golang项目,我使用postgres数据库通过一些存储过程来存储数据。

我使用 github.com/jinzhu/gorm 连接数据库。

我使用下面的查询来检索数据。我知道在postgres中我们无法使用select,所以我只尝试在SP中插入代码。

db.Database.Raw("CALL mydatabase.mystoredprocedure('" + param1 + "','" + param2 + "')")

db.Database.Raw("SELECT * FROM table1").Scan(&tableValue)
Run Code Online (Sandbox Code Playgroud)

但这里我只能调用 SELECT 语句,不能调用存储过程。

请问,有人可以帮我解决这个问题吗?

提前致谢