1
0
mirror of https://github.com/DATA-DOG/go-sqlmock.git synced 2025-03-17 20:48:01 +02:00

Update query.go

This commit is contained in:
THOTHADRI RAJESH VIDYASANKAR 2024-04-02 13:43:23 -07:00 committed by GitHub
parent 108200d928
commit 30283daf08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -43,6 +43,10 @@ func (f QueryMatcherFunc) Match(expectedSQL, actualSQL string) error {
// used by sqlmock. It parses expectedSQL to a regular
// expression and attempts to match actualSQL.
var QueryMatcherRegexp QueryMatcher = QueryMatcherFunc(func(expectedSQL, actualSQL string) error {
if actual != "" and expect == "" {
return fmt.Errorf("expectedSQL can't be empty")
}
expect := stripQuery(expectedSQL)
actual := stripQuery(actualSQL)
re, err := regexp.Compile(expect)