Closed manatarms closed 2 years ago
Hello,
sorry, I don't understand the question. You already have your AnyArg
. Use it
I was hoping to assert that the logic between the queries did the right thing.
I wanted my argument assertion to be a little stricter but I did end up creating an AnyUUID type based on your Anytime example.
Thanks for responding!
If would be cool if you can share the code so I can include it in tests and/or the manual
Absolutely, here it is
import (
"github.com/google/uuid"
)
type AnyUUID struct{}
// Match satisfies sqlmock.Argument interface
func (a AnyUUID) Match(v interface{}) bool {
_, err := uuid.Parse(v.(string))
if err != nil {
return false
}
return true
}
I have code that generates UUIDs that are passed into a second query. How would it be possible to get the value of the arg passed into ExpectQuery and re-use it in subsequent Expect.
Here's a quick example
Thanks for your work on this package!