代码拉取完成,页面将自动刷新
package pg_query
import (
proto "github.com/golang/protobuf/proto"
"github.com/pganalyze/pg_query_go/v2/parser"
)
// ParseToJSON - Parses the given SQL statement into a parse tree (JSON format)
func ParseToJSON(input string) (result string, err error) {
return parser.ParseToJSON(input)
}
// Parse the given SQL statement into a parse tree (Go struct format)
func Parse(input string) (tree *ParseResult, err error) {
protobufTree, err := parser.ParseToProtobuf(input)
if err != nil {
return
}
tree = &ParseResult{}
err = proto.Unmarshal(protobufTree, tree)
return
}
// Deparses a given Go parse tree into a SQL statement
func Deparse(tree *ParseResult) (output string, err error) {
protobufTree, err := proto.Marshal(tree)
if err != nil {
return
}
output, err = parser.DeparseFromProtobuf(protobufTree)
return
}
// ParsePlPgSqlToJSON - Parses the given PL/pgSQL function statement into a parse tree (JSON format)
func ParsePlPgSqlToJSON(input string) (result string, err error) {
return parser.ParsePlPgSqlToJSON(input)
}
// Normalize the passed SQL statement to replace constant values with ? characters
func Normalize(input string) (result string, err error) {
return parser.Normalize(input)
}
// FastFingerprint - Fingerprint the passed SQL statement
func Fingerprint(input string) (result string, err error) {
return parser.Fingerprint(input)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。