我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

Golang SQL查询语法验证器

Is there any third-party tool for validate SQL query before I execute it with the database/sql pacakge or any way to check the SQL query is right without getting a panic from database/sql that the query is invalid?

Finally, I found this SQL parser package. I colud use it for validate it.

func isSQLValid(sql string) (bool, error) {
    _, err := sqlparser.Parse(sql)
    if err != nil {
        return false, err
    }
    return true, nil
}

近期文章

  • 将Elm与现有的Web应用程序服务集成的正确方法
  • 在Golang中使用json.Decoder解码顶级JSON数组
  • 指针新手-纠正我
  • init()未在新程序包中运行
  • 反射。新返回<nil>而不是初始化的结构
  • 为什么struct字段的格式字符串总是小写
  • 是否可以限制每秒运行多少个goroutine?
  • Golang排序:未实现sort.Interface(缺少Len方法)
  • Golang向浏览器/客户端传达服务文件的名称
  • 将指针分配给Golang中的变量
  • 读取http.Response正文流
  • 比较Go中的错误
  • 常量在Go中如何工作?
  • 如何为私人注册表登录凭据创建“ RegistryAuth”
  • 在http.FileServer上登录404
  • 表测试多返回值功能
  • 在Go编译时是否评估常数值?
  • 初始化从0到N的整数的golang slice
  • 输入字节2564处的错误base64数据错误消息
  • 为什么地址大小不同? (0x206a10-0x104382e0)

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华