MCPcopy Create free account
hub / github.com/DATA-DOG/go-sqlmock / WithArgs

Method WithArgs

expectations.go:215–221  ·  view source on GitHub ↗

WithArgs will match given expected args to actual database exec operation arguments. if at least one argument does not match, it will return an error. For specific arguments an sqlmock.Argument interface can be used to match an argument. Must not be used together with WithoutArgs()

(args ...driver.Value)

Source from the content-addressed store, hash-verified

213// arguments an sqlmock.Argument interface can be used to match an argument.
214// Must not be used together with WithoutArgs()
215func (e *ExpectedExec) WithArgs(args ...driver.Value) *ExpectedExec {
216 if len(e.args) > 0 {
217 panic("WithArgs() and WithoutArgs() must not be used together")
218 }
219 e.args = args
220 return e
221}
222
223// WithoutArgs will ensure that no args are passed for this expected database exec action.
224// if at least one argument is passed, it will return an error. This allows for stricter

Callers 15

TestWrongNumberOfValuesFunction · 0.45
TestContextQueryCancelFunction · 0.45
TestContextQueryFunction · 0.45
TestAnyTimeArgumentFunction · 0.45
TestByteSliceArgumentFunction · 0.45
TestQueryMultiRowsFunction · 0.45
ExampleFunction · 0.45

Calls

no outgoing calls

Tested by 15

TestWrongNumberOfValuesFunction · 0.36
TestContextQueryCancelFunction · 0.36
TestContextQueryFunction · 0.36
TestAnyTimeArgumentFunction · 0.36
TestByteSliceArgumentFunction · 0.36
TestQueryMultiRowsFunction · 0.36
ExampleFunction · 0.36