Cross-database prepared statement binding (like and where in) in Golang

前端 未结 3 602
南笙
南笙 2021-01-19 12:43

After reading many tutorials, I found that there are many ways to bind arguments on prepared statement in Go, some of them

SELECT * FROM bla WHERE x = ?col1          


        
3条回答
  •  抹茶落季
    2021-01-19 13:28

    I'm a newbie to Go but just to answer the first part:

    First question, what is the cross-database way to bind arguments? (that works on any database)

    If you use sqlx, which is a superset of the built-in sql package, then you should be able to use sqlx.DB.Rebind to achieve that.

提交回复
热议问题