Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paremeter handling still not handled properly #21

Open
shackra opened this issue Jan 31, 2020 · 0 comments
Open

Paremeter handling still not handled properly #21

shackra opened this issue Jan 31, 2020 · 0 comments

Comments

@shackra
Copy link

shackra commented Jan 31, 2020

I noticed that the statement prepared by go-mocket and the one prepared by GORM were not the exact same:

`MOCK_FAKE_DRIVER` is not officially supported, running under compatibility mode.
2020/01/30 22:30:01 mock_catcher: check query: SELECT * FROM "documentos"  WHERE "documentos"."deleted_at" IS NULL AND ((clave = 50602121900026335208700100001010000000000181580890)) ORDER BY "documentos"."id" ASC LIMIT 1

(/home/jorge/code/kue/fero/dev/backend/utils.go:450) 
[2020-01-30 22:30:01]  [1.00ms]  SELECT * FROM "documentos"  WHERE "documentos"."deleted_at" IS NULL AND ((clave = '50602121900026335208700100001010000000000181580890')) ORDER BY "documentos"."id" ASC LIMIT 1  
[0 rows affected or returned ] 

notice that the long string of numbers has single quotes and the statement prepared by GORM has them. In #2 someone pointed out what was the issue (this line https://github.com/Selvatico/go-mocket/blob/master/stmt.go#L114 ). I'm aware of the challenge with getting a different query from GORM than the one go-mocket prepares, I would advise on providing users with a diff of sorts to warn them about the differences because small things like single quotes vs no quotes made me spent several hours figuring out what I was doing wrong.

shackra added a commit to shackra/go-mocket that referenced this issue Jan 31, 2020
Improves user experience explicitly showing the user what is the difference between the query and
the match string set in order to aid with test debugging. This commit should fix bug Selvatico#21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant