SQLite中的JSON函数
我试图让SQLite JSON函数与Go和SQLite中的JSON函数,json,sqlite,go,Json,Sqlite,Go,我试图让SQLite JSON函数与Go和github.com/mattn/Go-sqlite3驱动程序一起工作,但运气不太好 使用VSCode作为我的编辑器,我做到了: 转到getgithub.com/mattn/go-sqlite3 go构建——标记“json1”github.com/mattn/go-sqlite3 编写了调用以下函数的测试应用程序 执行代码/func时,出现以下错误: 没有这样的函数:json\u有效 我知道我可以编写一个结构并处理逻辑来验证存储在sqlite表列中的js
github.com/mattn/Go-sqlite3
驱动程序一起工作,但运气不太好
使用VSCode作为我的编辑器,我做到了:
github.com/mattn/go-sqlite3
github.com/mattn/go-sqlite3
func IsJSONValid(payloadID int) bool {
var isValid int
sql := `select json_valid(json_payload) from exec_payload where payload_id = ?`
err = database.QueryRow(sql, payloadID).Scan(&isValid)
if err != nil {
log.Println(err)
log.Println("Fatal - unable to validate JSON payload")
LogDb("IsJSONValid", "unable to validate JSON payload")
return false
}
if isValid == 0 {
return false
}
return true
}