From 922a8391791aec35c9adf38d2b02cb3205c83909 Mon Sep 17 00:00:00 2001 From: Amin Cheloh Date: Wed, 8 Nov 2023 11:45:07 +0700 Subject: [PATCH] run mockery with with-expecter option (#110) Co-authored-by: Amin Cheloh --- Makefile | 2 +- mocks/mockery/change_stream.go | 256 +++++++++ mocks/mockery/client.go | 388 +++++++++++++ mocks/mockery/client_encryption.go | 422 ++++++++++++++ mocks/mockery/collection.go | 861 +++++++++++++++++++++++++++++ mocks/mockery/cursor.go | 285 ++++++++++ mocks/mockery/database.go | 542 ++++++++++++++++++ mocks/mockery/index_view.go | 227 ++++++++ mocks/mockery/session.go | 328 +++++++++++ mocks/mockery/session_context.go | 437 +++++++++++++++ mocks/mockery/single_result.go | 90 +++ 11 files changed, 3837 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 34e0b66..d75c824 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ run-mockgen: @mockgen -destination=mocks/gomock/mocks.go -package mocks . ChangeStream,Client,Collection,Cursor,Database,IndexView,Session,SingleResult,SessionContext,ClientEncryption run-mockery: - @mockery --all --srcpkg github.com/sv-tools/mongoifc --output mocks/mockery --disable-version-string --case underscore + @mockery --all --with-expecter --srcpkg github.com/sv-tools/mongoifc --output mocks/mockery --disable-version-string --case underscore clean-mocks: @rm -rf mocks diff --git a/mocks/mockery/change_stream.go b/mocks/mockery/change_stream.go index f226ed2..f21580a 100644 --- a/mocks/mockery/change_stream.go +++ b/mocks/mockery/change_stream.go @@ -15,6 +15,14 @@ type ChangeStream struct { mock.Mock } +type ChangeStream_Expecter struct { + mock *mock.Mock +} + +func (_m *ChangeStream) EXPECT() *ChangeStream_Expecter { + return &ChangeStream_Expecter{mock: &_m.Mock} +} + // Close provides a mock function with given fields: ctx func (_m *ChangeStream) Close(ctx context.Context) error { ret := _m.Called(ctx) @@ -29,6 +37,34 @@ func (_m *ChangeStream) Close(ctx context.Context) error { return r0 } +// ChangeStream_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' +type ChangeStream_Close_Call struct { + *mock.Call +} + +// Close is a helper method to define mock.On call +// - ctx context.Context +func (_e *ChangeStream_Expecter) Close(ctx interface{}) *ChangeStream_Close_Call { + return &ChangeStream_Close_Call{Call: _e.mock.On("Close", ctx)} +} + +func (_c *ChangeStream_Close_Call) Run(run func(ctx context.Context)) *ChangeStream_Close_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *ChangeStream_Close_Call) Return(_a0 error) *ChangeStream_Close_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ChangeStream_Close_Call) RunAndReturn(run func(context.Context) error) *ChangeStream_Close_Call { + _c.Call.Return(run) + return _c +} + // Current provides a mock function with given fields: func (_m *ChangeStream) Current() bson.Raw { ret := _m.Called() @@ -45,6 +81,33 @@ func (_m *ChangeStream) Current() bson.Raw { return r0 } +// ChangeStream_Current_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Current' +type ChangeStream_Current_Call struct { + *mock.Call +} + +// Current is a helper method to define mock.On call +func (_e *ChangeStream_Expecter) Current() *ChangeStream_Current_Call { + return &ChangeStream_Current_Call{Call: _e.mock.On("Current")} +} + +func (_c *ChangeStream_Current_Call) Run(run func()) *ChangeStream_Current_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ChangeStream_Current_Call) Return(_a0 bson.Raw) *ChangeStream_Current_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ChangeStream_Current_Call) RunAndReturn(run func() bson.Raw) *ChangeStream_Current_Call { + _c.Call.Return(run) + return _c +} + // Decode provides a mock function with given fields: val func (_m *ChangeStream) Decode(val interface{}) error { ret := _m.Called(val) @@ -59,6 +122,34 @@ func (_m *ChangeStream) Decode(val interface{}) error { return r0 } +// ChangeStream_Decode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Decode' +type ChangeStream_Decode_Call struct { + *mock.Call +} + +// Decode is a helper method to define mock.On call +// - val interface{} +func (_e *ChangeStream_Expecter) Decode(val interface{}) *ChangeStream_Decode_Call { + return &ChangeStream_Decode_Call{Call: _e.mock.On("Decode", val)} +} + +func (_c *ChangeStream_Decode_Call) Run(run func(val interface{})) *ChangeStream_Decode_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(interface{})) + }) + return _c +} + +func (_c *ChangeStream_Decode_Call) Return(_a0 error) *ChangeStream_Decode_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ChangeStream_Decode_Call) RunAndReturn(run func(interface{}) error) *ChangeStream_Decode_Call { + _c.Call.Return(run) + return _c +} + // Err provides a mock function with given fields: func (_m *ChangeStream) Err() error { ret := _m.Called() @@ -73,6 +164,33 @@ func (_m *ChangeStream) Err() error { return r0 } +// ChangeStream_Err_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Err' +type ChangeStream_Err_Call struct { + *mock.Call +} + +// Err is a helper method to define mock.On call +func (_e *ChangeStream_Expecter) Err() *ChangeStream_Err_Call { + return &ChangeStream_Err_Call{Call: _e.mock.On("Err")} +} + +func (_c *ChangeStream_Err_Call) Run(run func()) *ChangeStream_Err_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ChangeStream_Err_Call) Return(_a0 error) *ChangeStream_Err_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ChangeStream_Err_Call) RunAndReturn(run func() error) *ChangeStream_Err_Call { + _c.Call.Return(run) + return _c +} + // ID provides a mock function with given fields: func (_m *ChangeStream) ID() int64 { ret := _m.Called() @@ -87,6 +205,33 @@ func (_m *ChangeStream) ID() int64 { return r0 } +// ChangeStream_ID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ID' +type ChangeStream_ID_Call struct { + *mock.Call +} + +// ID is a helper method to define mock.On call +func (_e *ChangeStream_Expecter) ID() *ChangeStream_ID_Call { + return &ChangeStream_ID_Call{Call: _e.mock.On("ID")} +} + +func (_c *ChangeStream_ID_Call) Run(run func()) *ChangeStream_ID_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ChangeStream_ID_Call) Return(_a0 int64) *ChangeStream_ID_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ChangeStream_ID_Call) RunAndReturn(run func() int64) *ChangeStream_ID_Call { + _c.Call.Return(run) + return _c +} + // Next provides a mock function with given fields: ctx func (_m *ChangeStream) Next(ctx context.Context) bool { ret := _m.Called(ctx) @@ -101,6 +246,34 @@ func (_m *ChangeStream) Next(ctx context.Context) bool { return r0 } +// ChangeStream_Next_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Next' +type ChangeStream_Next_Call struct { + *mock.Call +} + +// Next is a helper method to define mock.On call +// - ctx context.Context +func (_e *ChangeStream_Expecter) Next(ctx interface{}) *ChangeStream_Next_Call { + return &ChangeStream_Next_Call{Call: _e.mock.On("Next", ctx)} +} + +func (_c *ChangeStream_Next_Call) Run(run func(ctx context.Context)) *ChangeStream_Next_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *ChangeStream_Next_Call) Return(_a0 bool) *ChangeStream_Next_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ChangeStream_Next_Call) RunAndReturn(run func(context.Context) bool) *ChangeStream_Next_Call { + _c.Call.Return(run) + return _c +} + // ResumeToken provides a mock function with given fields: func (_m *ChangeStream) ResumeToken() bson.Raw { ret := _m.Called() @@ -117,11 +290,66 @@ func (_m *ChangeStream) ResumeToken() bson.Raw { return r0 } +// ChangeStream_ResumeToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResumeToken' +type ChangeStream_ResumeToken_Call struct { + *mock.Call +} + +// ResumeToken is a helper method to define mock.On call +func (_e *ChangeStream_Expecter) ResumeToken() *ChangeStream_ResumeToken_Call { + return &ChangeStream_ResumeToken_Call{Call: _e.mock.On("ResumeToken")} +} + +func (_c *ChangeStream_ResumeToken_Call) Run(run func()) *ChangeStream_ResumeToken_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ChangeStream_ResumeToken_Call) Return(_a0 bson.Raw) *ChangeStream_ResumeToken_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ChangeStream_ResumeToken_Call) RunAndReturn(run func() bson.Raw) *ChangeStream_ResumeToken_Call { + _c.Call.Return(run) + return _c +} + // SetBatchSize provides a mock function with given fields: size func (_m *ChangeStream) SetBatchSize(size int32) { _m.Called(size) } +// ChangeStream_SetBatchSize_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetBatchSize' +type ChangeStream_SetBatchSize_Call struct { + *mock.Call +} + +// SetBatchSize is a helper method to define mock.On call +// - size int32 +func (_e *ChangeStream_Expecter) SetBatchSize(size interface{}) *ChangeStream_SetBatchSize_Call { + return &ChangeStream_SetBatchSize_Call{Call: _e.mock.On("SetBatchSize", size)} +} + +func (_c *ChangeStream_SetBatchSize_Call) Run(run func(size int32)) *ChangeStream_SetBatchSize_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(int32)) + }) + return _c +} + +func (_c *ChangeStream_SetBatchSize_Call) Return() *ChangeStream_SetBatchSize_Call { + _c.Call.Return() + return _c +} + +func (_c *ChangeStream_SetBatchSize_Call) RunAndReturn(run func(int32)) *ChangeStream_SetBatchSize_Call { + _c.Call.Return(run) + return _c +} + // TryNext provides a mock function with given fields: ctx func (_m *ChangeStream) TryNext(ctx context.Context) bool { ret := _m.Called(ctx) @@ -136,6 +364,34 @@ func (_m *ChangeStream) TryNext(ctx context.Context) bool { return r0 } +// ChangeStream_TryNext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TryNext' +type ChangeStream_TryNext_Call struct { + *mock.Call +} + +// TryNext is a helper method to define mock.On call +// - ctx context.Context +func (_e *ChangeStream_Expecter) TryNext(ctx interface{}) *ChangeStream_TryNext_Call { + return &ChangeStream_TryNext_Call{Call: _e.mock.On("TryNext", ctx)} +} + +func (_c *ChangeStream_TryNext_Call) Run(run func(ctx context.Context)) *ChangeStream_TryNext_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *ChangeStream_TryNext_Call) Return(_a0 bool) *ChangeStream_TryNext_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ChangeStream_TryNext_Call) RunAndReturn(run func(context.Context) bool) *ChangeStream_TryNext_Call { + _c.Call.Return(run) + return _c +} + // NewChangeStream creates a new instance of ChangeStream. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewChangeStream(t interface { diff --git a/mocks/mockery/client.go b/mocks/mockery/client.go index cbec7f1..119321a 100644 --- a/mocks/mockery/client.go +++ b/mocks/mockery/client.go @@ -22,6 +22,14 @@ type Client struct { mock.Mock } +type Client_Expecter struct { + mock *mock.Mock +} + +func (_m *Client) EXPECT() *Client_Expecter { + return &Client_Expecter{mock: &_m.Mock} +} + // Connect provides a mock function with given fields: ctx func (_m *Client) Connect(ctx context.Context) error { ret := _m.Called(ctx) @@ -36,6 +44,34 @@ func (_m *Client) Connect(ctx context.Context) error { return r0 } +// Client_Connect_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Connect' +type Client_Connect_Call struct { + *mock.Call +} + +// Connect is a helper method to define mock.On call +// - ctx context.Context +func (_e *Client_Expecter) Connect(ctx interface{}) *Client_Connect_Call { + return &Client_Connect_Call{Call: _e.mock.On("Connect", ctx)} +} + +func (_c *Client_Connect_Call) Run(run func(ctx context.Context)) *Client_Connect_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Client_Connect_Call) Return(_a0 error) *Client_Connect_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_Connect_Call) RunAndReturn(run func(context.Context) error) *Client_Connect_Call { + _c.Call.Return(run) + return _c +} + // Database provides a mock function with given fields: name, opts func (_m *Client) Database(name string, opts ...*options.DatabaseOptions) mongoifc.Database { _va := make([]interface{}, len(opts)) @@ -59,6 +95,42 @@ func (_m *Client) Database(name string, opts ...*options.DatabaseOptions) mongoi return r0 } +// Client_Database_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Database' +type Client_Database_Call struct { + *mock.Call +} + +// Database is a helper method to define mock.On call +// - name string +// - opts ...*options.DatabaseOptions +func (_e *Client_Expecter) Database(name interface{}, opts ...interface{}) *Client_Database_Call { + return &Client_Database_Call{Call: _e.mock.On("Database", + append([]interface{}{name}, opts...)...)} +} + +func (_c *Client_Database_Call) Run(run func(name string, opts ...*options.DatabaseOptions)) *Client_Database_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.DatabaseOptions, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(*options.DatabaseOptions) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *Client_Database_Call) Return(_a0 mongoifc.Database) *Client_Database_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_Database_Call) RunAndReturn(run func(string, ...*options.DatabaseOptions) mongoifc.Database) *Client_Database_Call { + _c.Call.Return(run) + return _c +} + // Disconnect provides a mock function with given fields: ctx func (_m *Client) Disconnect(ctx context.Context) error { ret := _m.Called(ctx) @@ -73,6 +145,34 @@ func (_m *Client) Disconnect(ctx context.Context) error { return r0 } +// Client_Disconnect_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Disconnect' +type Client_Disconnect_Call struct { + *mock.Call +} + +// Disconnect is a helper method to define mock.On call +// - ctx context.Context +func (_e *Client_Expecter) Disconnect(ctx interface{}) *Client_Disconnect_Call { + return &Client_Disconnect_Call{Call: _e.mock.On("Disconnect", ctx)} +} + +func (_c *Client_Disconnect_Call) Run(run func(ctx context.Context)) *Client_Disconnect_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Client_Disconnect_Call) Return(_a0 error) *Client_Disconnect_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_Disconnect_Call) RunAndReturn(run func(context.Context) error) *Client_Disconnect_Call { + _c.Call.Return(run) + return _c +} + // ListDatabaseNames provides a mock function with given fields: ctx, filter, opts func (_m *Client) ListDatabaseNames(ctx context.Context, filter interface{}, opts ...*options.ListDatabasesOptions) ([]string, error) { _va := make([]interface{}, len(opts)) @@ -106,6 +206,43 @@ func (_m *Client) ListDatabaseNames(ctx context.Context, filter interface{}, opt return r0, r1 } +// Client_ListDatabaseNames_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabaseNames' +type Client_ListDatabaseNames_Call struct { + *mock.Call +} + +// ListDatabaseNames is a helper method to define mock.On call +// - ctx context.Context +// - filter interface{} +// - opts ...*options.ListDatabasesOptions +func (_e *Client_Expecter) ListDatabaseNames(ctx interface{}, filter interface{}, opts ...interface{}) *Client_ListDatabaseNames_Call { + return &Client_ListDatabaseNames_Call{Call: _e.mock.On("ListDatabaseNames", + append([]interface{}{ctx, filter}, opts...)...)} +} + +func (_c *Client_ListDatabaseNames_Call) Run(run func(ctx context.Context, filter interface{}, opts ...*options.ListDatabasesOptions)) *Client_ListDatabaseNames_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.ListDatabasesOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.ListDatabasesOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Client_ListDatabaseNames_Call) Return(_a0 []string, _a1 error) *Client_ListDatabaseNames_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_ListDatabaseNames_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.ListDatabasesOptions) ([]string, error)) *Client_ListDatabaseNames_Call { + _c.Call.Return(run) + return _c +} + // ListDatabases provides a mock function with given fields: ctx, filter, opts func (_m *Client) ListDatabases(ctx context.Context, filter interface{}, opts ...*options.ListDatabasesOptions) (mongo.ListDatabasesResult, error) { _va := make([]interface{}, len(opts)) @@ -137,6 +274,43 @@ func (_m *Client) ListDatabases(ctx context.Context, filter interface{}, opts .. return r0, r1 } +// Client_ListDatabases_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDatabases' +type Client_ListDatabases_Call struct { + *mock.Call +} + +// ListDatabases is a helper method to define mock.On call +// - ctx context.Context +// - filter interface{} +// - opts ...*options.ListDatabasesOptions +func (_e *Client_Expecter) ListDatabases(ctx interface{}, filter interface{}, opts ...interface{}) *Client_ListDatabases_Call { + return &Client_ListDatabases_Call{Call: _e.mock.On("ListDatabases", + append([]interface{}{ctx, filter}, opts...)...)} +} + +func (_c *Client_ListDatabases_Call) Run(run func(ctx context.Context, filter interface{}, opts ...*options.ListDatabasesOptions)) *Client_ListDatabases_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.ListDatabasesOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.ListDatabasesOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Client_ListDatabases_Call) Return(_a0 mongo.ListDatabasesResult, _a1 error) *Client_ListDatabases_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_ListDatabases_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.ListDatabasesOptions) (mongo.ListDatabasesResult, error)) *Client_ListDatabases_Call { + _c.Call.Return(run) + return _c +} + // NumberSessionsInProgress provides a mock function with given fields: func (_m *Client) NumberSessionsInProgress() int { ret := _m.Called() @@ -151,6 +325,33 @@ func (_m *Client) NumberSessionsInProgress() int { return r0 } +// Client_NumberSessionsInProgress_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NumberSessionsInProgress' +type Client_NumberSessionsInProgress_Call struct { + *mock.Call +} + +// NumberSessionsInProgress is a helper method to define mock.On call +func (_e *Client_Expecter) NumberSessionsInProgress() *Client_NumberSessionsInProgress_Call { + return &Client_NumberSessionsInProgress_Call{Call: _e.mock.On("NumberSessionsInProgress")} +} + +func (_c *Client_NumberSessionsInProgress_Call) Run(run func()) *Client_NumberSessionsInProgress_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Client_NumberSessionsInProgress_Call) Return(_a0 int) *Client_NumberSessionsInProgress_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_NumberSessionsInProgress_Call) RunAndReturn(run func() int) *Client_NumberSessionsInProgress_Call { + _c.Call.Return(run) + return _c +} + // Ping provides a mock function with given fields: ctx, rp func (_m *Client) Ping(ctx context.Context, rp *readpref.ReadPref) error { ret := _m.Called(ctx, rp) @@ -165,6 +366,35 @@ func (_m *Client) Ping(ctx context.Context, rp *readpref.ReadPref) error { return r0 } +// Client_Ping_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Ping' +type Client_Ping_Call struct { + *mock.Call +} + +// Ping is a helper method to define mock.On call +// - ctx context.Context +// - rp *readpref.ReadPref +func (_e *Client_Expecter) Ping(ctx interface{}, rp interface{}) *Client_Ping_Call { + return &Client_Ping_Call{Call: _e.mock.On("Ping", ctx, rp)} +} + +func (_c *Client_Ping_Call) Run(run func(ctx context.Context, rp *readpref.ReadPref)) *Client_Ping_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*readpref.ReadPref)) + }) + return _c +} + +func (_c *Client_Ping_Call) Return(_a0 error) *Client_Ping_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_Ping_Call) RunAndReturn(run func(context.Context, *readpref.ReadPref) error) *Client_Ping_Call { + _c.Call.Return(run) + return _c +} + // StartSession provides a mock function with given fields: opts func (_m *Client) StartSession(opts ...*options.SessionOptions) (mongoifc.Session, error) { _va := make([]interface{}, len(opts)) @@ -197,6 +427,41 @@ func (_m *Client) StartSession(opts ...*options.SessionOptions) (mongoifc.Sessio return r0, r1 } +// Client_StartSession_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartSession' +type Client_StartSession_Call struct { + *mock.Call +} + +// StartSession is a helper method to define mock.On call +// - opts ...*options.SessionOptions +func (_e *Client_Expecter) StartSession(opts ...interface{}) *Client_StartSession_Call { + return &Client_StartSession_Call{Call: _e.mock.On("StartSession", + append([]interface{}{}, opts...)...)} +} + +func (_c *Client_StartSession_Call) Run(run func(opts ...*options.SessionOptions)) *Client_StartSession_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.SessionOptions, len(args)-0) + for i, a := range args[0:] { + if a != nil { + variadicArgs[i] = a.(*options.SessionOptions) + } + } + run(variadicArgs...) + }) + return _c +} + +func (_c *Client_StartSession_Call) Return(_a0 mongoifc.Session, _a1 error) *Client_StartSession_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_StartSession_Call) RunAndReturn(run func(...*options.SessionOptions) (mongoifc.Session, error)) *Client_StartSession_Call { + _c.Call.Return(run) + return _c +} + // Timeout provides a mock function with given fields: func (_m *Client) Timeout() *time.Duration { ret := _m.Called() @@ -213,6 +478,33 @@ func (_m *Client) Timeout() *time.Duration { return r0 } +// Client_Timeout_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Timeout' +type Client_Timeout_Call struct { + *mock.Call +} + +// Timeout is a helper method to define mock.On call +func (_e *Client_Expecter) Timeout() *Client_Timeout_Call { + return &Client_Timeout_Call{Call: _e.mock.On("Timeout")} +} + +func (_c *Client_Timeout_Call) Run(run func()) *Client_Timeout_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Client_Timeout_Call) Return(_a0 *time.Duration) *Client_Timeout_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_Timeout_Call) RunAndReturn(run func() *time.Duration) *Client_Timeout_Call { + _c.Call.Return(run) + return _c +} + // UseSession provides a mock function with given fields: ctx, fn func (_m *Client) UseSession(ctx context.Context, fn func(mongoifc.SessionContext) error) error { ret := _m.Called(ctx, fn) @@ -227,6 +519,35 @@ func (_m *Client) UseSession(ctx context.Context, fn func(mongoifc.SessionContex return r0 } +// Client_UseSession_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UseSession' +type Client_UseSession_Call struct { + *mock.Call +} + +// UseSession is a helper method to define mock.On call +// - ctx context.Context +// - fn func(mongoifc.SessionContext) error +func (_e *Client_Expecter) UseSession(ctx interface{}, fn interface{}) *Client_UseSession_Call { + return &Client_UseSession_Call{Call: _e.mock.On("UseSession", ctx, fn)} +} + +func (_c *Client_UseSession_Call) Run(run func(ctx context.Context, fn func(mongoifc.SessionContext) error)) *Client_UseSession_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(func(mongoifc.SessionContext) error)) + }) + return _c +} + +func (_c *Client_UseSession_Call) Return(_a0 error) *Client_UseSession_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_UseSession_Call) RunAndReturn(run func(context.Context, func(mongoifc.SessionContext) error) error) *Client_UseSession_Call { + _c.Call.Return(run) + return _c +} + // UseSessionWithOptions provides a mock function with given fields: ctx, opts, fn func (_m *Client) UseSessionWithOptions(ctx context.Context, opts *options.SessionOptions, fn func(mongoifc.SessionContext) error) error { ret := _m.Called(ctx, opts, fn) @@ -241,6 +562,36 @@ func (_m *Client) UseSessionWithOptions(ctx context.Context, opts *options.Sessi return r0 } +// Client_UseSessionWithOptions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UseSessionWithOptions' +type Client_UseSessionWithOptions_Call struct { + *mock.Call +} + +// UseSessionWithOptions is a helper method to define mock.On call +// - ctx context.Context +// - opts *options.SessionOptions +// - fn func(mongoifc.SessionContext) error +func (_e *Client_Expecter) UseSessionWithOptions(ctx interface{}, opts interface{}, fn interface{}) *Client_UseSessionWithOptions_Call { + return &Client_UseSessionWithOptions_Call{Call: _e.mock.On("UseSessionWithOptions", ctx, opts, fn)} +} + +func (_c *Client_UseSessionWithOptions_Call) Run(run func(ctx context.Context, opts *options.SessionOptions, fn func(mongoifc.SessionContext) error)) *Client_UseSessionWithOptions_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*options.SessionOptions), args[2].(func(mongoifc.SessionContext) error)) + }) + return _c +} + +func (_c *Client_UseSessionWithOptions_Call) Return(_a0 error) *Client_UseSessionWithOptions_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Client_UseSessionWithOptions_Call) RunAndReturn(run func(context.Context, *options.SessionOptions, func(mongoifc.SessionContext) error) error) *Client_UseSessionWithOptions_Call { + _c.Call.Return(run) + return _c +} + // Watch provides a mock function with given fields: ctx, pipeline, opts func (_m *Client) Watch(ctx context.Context, pipeline interface{}, opts ...*options.ChangeStreamOptions) (mongoifc.ChangeStream, error) { _va := make([]interface{}, len(opts)) @@ -274,6 +625,43 @@ func (_m *Client) Watch(ctx context.Context, pipeline interface{}, opts ...*opti return r0, r1 } +// Client_Watch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Watch' +type Client_Watch_Call struct { + *mock.Call +} + +// Watch is a helper method to define mock.On call +// - ctx context.Context +// - pipeline interface{} +// - opts ...*options.ChangeStreamOptions +func (_e *Client_Expecter) Watch(ctx interface{}, pipeline interface{}, opts ...interface{}) *Client_Watch_Call { + return &Client_Watch_Call{Call: _e.mock.On("Watch", + append([]interface{}{ctx, pipeline}, opts...)...)} +} + +func (_c *Client_Watch_Call) Run(run func(ctx context.Context, pipeline interface{}, opts ...*options.ChangeStreamOptions)) *Client_Watch_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.ChangeStreamOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.ChangeStreamOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Client_Watch_Call) Return(_a0 mongoifc.ChangeStream, _a1 error) *Client_Watch_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Client_Watch_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.ChangeStreamOptions) (mongoifc.ChangeStream, error)) *Client_Watch_Call { + _c.Call.Return(run) + return _c +} + // NewClient creates a new instance of Client. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewClient(t interface { diff --git a/mocks/mockery/client_encryption.go b/mocks/mockery/client_encryption.go index 7340e5f..f89fda3 100644 --- a/mocks/mockery/client_encryption.go +++ b/mocks/mockery/client_encryption.go @@ -23,6 +23,14 @@ type ClientEncryption struct { mock.Mock } +type ClientEncryption_Expecter struct { + mock *mock.Mock +} + +func (_m *ClientEncryption) EXPECT() *ClientEncryption_Expecter { + return &ClientEncryption_Expecter{mock: &_m.Mock} +} + // AddKeyAltName provides a mock function with given fields: ctx, id, keyAltName func (_m *ClientEncryption) AddKeyAltName(ctx context.Context, id primitive.Binary, keyAltName string) mongoifc.SingleResult { ret := _m.Called(ctx, id, keyAltName) @@ -39,6 +47,36 @@ func (_m *ClientEncryption) AddKeyAltName(ctx context.Context, id primitive.Bina return r0 } +// ClientEncryption_AddKeyAltName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddKeyAltName' +type ClientEncryption_AddKeyAltName_Call struct { + *mock.Call +} + +// AddKeyAltName is a helper method to define mock.On call +// - ctx context.Context +// - id primitive.Binary +// - keyAltName string +func (_e *ClientEncryption_Expecter) AddKeyAltName(ctx interface{}, id interface{}, keyAltName interface{}) *ClientEncryption_AddKeyAltName_Call { + return &ClientEncryption_AddKeyAltName_Call{Call: _e.mock.On("AddKeyAltName", ctx, id, keyAltName)} +} + +func (_c *ClientEncryption_AddKeyAltName_Call) Run(run func(ctx context.Context, id primitive.Binary, keyAltName string)) *ClientEncryption_AddKeyAltName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(primitive.Binary), args[2].(string)) + }) + return _c +} + +func (_c *ClientEncryption_AddKeyAltName_Call) Return(_a0 mongoifc.SingleResult) *ClientEncryption_AddKeyAltName_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ClientEncryption_AddKeyAltName_Call) RunAndReturn(run func(context.Context, primitive.Binary, string) mongoifc.SingleResult) *ClientEncryption_AddKeyAltName_Call { + _c.Call.Return(run) + return _c +} + // Close provides a mock function with given fields: ctx func (_m *ClientEncryption) Close(ctx context.Context) error { ret := _m.Called(ctx) @@ -53,6 +91,34 @@ func (_m *ClientEncryption) Close(ctx context.Context) error { return r0 } +// ClientEncryption_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' +type ClientEncryption_Close_Call struct { + *mock.Call +} + +// Close is a helper method to define mock.On call +// - ctx context.Context +func (_e *ClientEncryption_Expecter) Close(ctx interface{}) *ClientEncryption_Close_Call { + return &ClientEncryption_Close_Call{Call: _e.mock.On("Close", ctx)} +} + +func (_c *ClientEncryption_Close_Call) Run(run func(ctx context.Context)) *ClientEncryption_Close_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *ClientEncryption_Close_Call) Return(_a0 error) *ClientEncryption_Close_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ClientEncryption_Close_Call) RunAndReturn(run func(context.Context) error) *ClientEncryption_Close_Call { + _c.Call.Return(run) + return _c +} + // CreateDataKey provides a mock function with given fields: ctx, kmsProvider, opts func (_m *ClientEncryption) CreateDataKey(ctx context.Context, kmsProvider string, opts ...*options.DataKeyOptions) (primitive.Binary, error) { _va := make([]interface{}, len(opts)) @@ -84,6 +150,43 @@ func (_m *ClientEncryption) CreateDataKey(ctx context.Context, kmsProvider strin return r0, r1 } +// ClientEncryption_CreateDataKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateDataKey' +type ClientEncryption_CreateDataKey_Call struct { + *mock.Call +} + +// CreateDataKey is a helper method to define mock.On call +// - ctx context.Context +// - kmsProvider string +// - opts ...*options.DataKeyOptions +func (_e *ClientEncryption_Expecter) CreateDataKey(ctx interface{}, kmsProvider interface{}, opts ...interface{}) *ClientEncryption_CreateDataKey_Call { + return &ClientEncryption_CreateDataKey_Call{Call: _e.mock.On("CreateDataKey", + append([]interface{}{ctx, kmsProvider}, opts...)...)} +} + +func (_c *ClientEncryption_CreateDataKey_Call) Run(run func(ctx context.Context, kmsProvider string, opts ...*options.DataKeyOptions)) *ClientEncryption_CreateDataKey_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.DataKeyOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.DataKeyOptions) + } + } + run(args[0].(context.Context), args[1].(string), variadicArgs...) + }) + return _c +} + +func (_c *ClientEncryption_CreateDataKey_Call) Return(_a0 primitive.Binary, _a1 error) *ClientEncryption_CreateDataKey_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ClientEncryption_CreateDataKey_Call) RunAndReturn(run func(context.Context, string, ...*options.DataKeyOptions) (primitive.Binary, error)) *ClientEncryption_CreateDataKey_Call { + _c.Call.Return(run) + return _c +} + // CreateEncryptedCollection provides a mock function with given fields: ctx, db, coll, createOpts, kmsProvider, masterKey func (_m *ClientEncryption) CreateEncryptedCollection(ctx context.Context, db mongoifc.Database, coll string, createOpts *options.CreateCollectionOptions, kmsProvider string, masterKey interface{}) (mongoifc.Collection, primitive.M, error) { ret := _m.Called(ctx, db, coll, createOpts, kmsProvider, masterKey) @@ -119,6 +222,39 @@ func (_m *ClientEncryption) CreateEncryptedCollection(ctx context.Context, db mo return r0, r1, r2 } +// ClientEncryption_CreateEncryptedCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateEncryptedCollection' +type ClientEncryption_CreateEncryptedCollection_Call struct { + *mock.Call +} + +// CreateEncryptedCollection is a helper method to define mock.On call +// - ctx context.Context +// - db mongoifc.Database +// - coll string +// - createOpts *options.CreateCollectionOptions +// - kmsProvider string +// - masterKey interface{} +func (_e *ClientEncryption_Expecter) CreateEncryptedCollection(ctx interface{}, db interface{}, coll interface{}, createOpts interface{}, kmsProvider interface{}, masterKey interface{}) *ClientEncryption_CreateEncryptedCollection_Call { + return &ClientEncryption_CreateEncryptedCollection_Call{Call: _e.mock.On("CreateEncryptedCollection", ctx, db, coll, createOpts, kmsProvider, masterKey)} +} + +func (_c *ClientEncryption_CreateEncryptedCollection_Call) Run(run func(ctx context.Context, db mongoifc.Database, coll string, createOpts *options.CreateCollectionOptions, kmsProvider string, masterKey interface{})) *ClientEncryption_CreateEncryptedCollection_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(mongoifc.Database), args[2].(string), args[3].(*options.CreateCollectionOptions), args[4].(string), args[5].(interface{})) + }) + return _c +} + +func (_c *ClientEncryption_CreateEncryptedCollection_Call) Return(_a0 mongoifc.Collection, _a1 primitive.M, _a2 error) *ClientEncryption_CreateEncryptedCollection_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *ClientEncryption_CreateEncryptedCollection_Call) RunAndReturn(run func(context.Context, mongoifc.Database, string, *options.CreateCollectionOptions, string, interface{}) (mongoifc.Collection, primitive.M, error)) *ClientEncryption_CreateEncryptedCollection_Call { + _c.Call.Return(run) + return _c +} + // Decrypt provides a mock function with given fields: ctx, val func (_m *ClientEncryption) Decrypt(ctx context.Context, val primitive.Binary) (bson.RawValue, error) { ret := _m.Called(ctx, val) @@ -143,6 +279,35 @@ func (_m *ClientEncryption) Decrypt(ctx context.Context, val primitive.Binary) ( return r0, r1 } +// ClientEncryption_Decrypt_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Decrypt' +type ClientEncryption_Decrypt_Call struct { + *mock.Call +} + +// Decrypt is a helper method to define mock.On call +// - ctx context.Context +// - val primitive.Binary +func (_e *ClientEncryption_Expecter) Decrypt(ctx interface{}, val interface{}) *ClientEncryption_Decrypt_Call { + return &ClientEncryption_Decrypt_Call{Call: _e.mock.On("Decrypt", ctx, val)} +} + +func (_c *ClientEncryption_Decrypt_Call) Run(run func(ctx context.Context, val primitive.Binary)) *ClientEncryption_Decrypt_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(primitive.Binary)) + }) + return _c +} + +func (_c *ClientEncryption_Decrypt_Call) Return(_a0 bson.RawValue, _a1 error) *ClientEncryption_Decrypt_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ClientEncryption_Decrypt_Call) RunAndReturn(run func(context.Context, primitive.Binary) (bson.RawValue, error)) *ClientEncryption_Decrypt_Call { + _c.Call.Return(run) + return _c +} + // DeleteKey provides a mock function with given fields: ctx, id func (_m *ClientEncryption) DeleteKey(ctx context.Context, id primitive.Binary) (*mongo.DeleteResult, error) { ret := _m.Called(ctx, id) @@ -169,6 +334,35 @@ func (_m *ClientEncryption) DeleteKey(ctx context.Context, id primitive.Binary) return r0, r1 } +// ClientEncryption_DeleteKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteKey' +type ClientEncryption_DeleteKey_Call struct { + *mock.Call +} + +// DeleteKey is a helper method to define mock.On call +// - ctx context.Context +// - id primitive.Binary +func (_e *ClientEncryption_Expecter) DeleteKey(ctx interface{}, id interface{}) *ClientEncryption_DeleteKey_Call { + return &ClientEncryption_DeleteKey_Call{Call: _e.mock.On("DeleteKey", ctx, id)} +} + +func (_c *ClientEncryption_DeleteKey_Call) Run(run func(ctx context.Context, id primitive.Binary)) *ClientEncryption_DeleteKey_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(primitive.Binary)) + }) + return _c +} + +func (_c *ClientEncryption_DeleteKey_Call) Return(_a0 *mongo.DeleteResult, _a1 error) *ClientEncryption_DeleteKey_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ClientEncryption_DeleteKey_Call) RunAndReturn(run func(context.Context, primitive.Binary) (*mongo.DeleteResult, error)) *ClientEncryption_DeleteKey_Call { + _c.Call.Return(run) + return _c +} + // Encrypt provides a mock function with given fields: ctx, val, opts func (_m *ClientEncryption) Encrypt(ctx context.Context, val bson.RawValue, opts ...*options.EncryptOptions) (primitive.Binary, error) { _va := make([]interface{}, len(opts)) @@ -200,6 +394,43 @@ func (_m *ClientEncryption) Encrypt(ctx context.Context, val bson.RawValue, opts return r0, r1 } +// ClientEncryption_Encrypt_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Encrypt' +type ClientEncryption_Encrypt_Call struct { + *mock.Call +} + +// Encrypt is a helper method to define mock.On call +// - ctx context.Context +// - val bson.RawValue +// - opts ...*options.EncryptOptions +func (_e *ClientEncryption_Expecter) Encrypt(ctx interface{}, val interface{}, opts ...interface{}) *ClientEncryption_Encrypt_Call { + return &ClientEncryption_Encrypt_Call{Call: _e.mock.On("Encrypt", + append([]interface{}{ctx, val}, opts...)...)} +} + +func (_c *ClientEncryption_Encrypt_Call) Run(run func(ctx context.Context, val bson.RawValue, opts ...*options.EncryptOptions)) *ClientEncryption_Encrypt_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.EncryptOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.EncryptOptions) + } + } + run(args[0].(context.Context), args[1].(bson.RawValue), variadicArgs...) + }) + return _c +} + +func (_c *ClientEncryption_Encrypt_Call) Return(_a0 primitive.Binary, _a1 error) *ClientEncryption_Encrypt_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ClientEncryption_Encrypt_Call) RunAndReturn(run func(context.Context, bson.RawValue, ...*options.EncryptOptions) (primitive.Binary, error)) *ClientEncryption_Encrypt_Call { + _c.Call.Return(run) + return _c +} + // EncryptExpression provides a mock function with given fields: ctx, expr, result, opts func (_m *ClientEncryption) EncryptExpression(ctx context.Context, expr interface{}, result interface{}, opts ...*options.EncryptOptions) error { _va := make([]interface{}, len(opts)) @@ -221,6 +452,44 @@ func (_m *ClientEncryption) EncryptExpression(ctx context.Context, expr interfac return r0 } +// ClientEncryption_EncryptExpression_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EncryptExpression' +type ClientEncryption_EncryptExpression_Call struct { + *mock.Call +} + +// EncryptExpression is a helper method to define mock.On call +// - ctx context.Context +// - expr interface{} +// - result interface{} +// - opts ...*options.EncryptOptions +func (_e *ClientEncryption_Expecter) EncryptExpression(ctx interface{}, expr interface{}, result interface{}, opts ...interface{}) *ClientEncryption_EncryptExpression_Call { + return &ClientEncryption_EncryptExpression_Call{Call: _e.mock.On("EncryptExpression", + append([]interface{}{ctx, expr, result}, opts...)...)} +} + +func (_c *ClientEncryption_EncryptExpression_Call) Run(run func(ctx context.Context, expr interface{}, result interface{}, opts ...*options.EncryptOptions)) *ClientEncryption_EncryptExpression_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.EncryptOptions, len(args)-3) + for i, a := range args[3:] { + if a != nil { + variadicArgs[i] = a.(*options.EncryptOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), args[2].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *ClientEncryption_EncryptExpression_Call) Return(_a0 error) *ClientEncryption_EncryptExpression_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ClientEncryption_EncryptExpression_Call) RunAndReturn(run func(context.Context, interface{}, interface{}, ...*options.EncryptOptions) error) *ClientEncryption_EncryptExpression_Call { + _c.Call.Return(run) + return _c +} + // GetKey provides a mock function with given fields: ctx, id func (_m *ClientEncryption) GetKey(ctx context.Context, id primitive.Binary) mongoifc.SingleResult { ret := _m.Called(ctx, id) @@ -237,6 +506,35 @@ func (_m *ClientEncryption) GetKey(ctx context.Context, id primitive.Binary) mon return r0 } +// ClientEncryption_GetKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetKey' +type ClientEncryption_GetKey_Call struct { + *mock.Call +} + +// GetKey is a helper method to define mock.On call +// - ctx context.Context +// - id primitive.Binary +func (_e *ClientEncryption_Expecter) GetKey(ctx interface{}, id interface{}) *ClientEncryption_GetKey_Call { + return &ClientEncryption_GetKey_Call{Call: _e.mock.On("GetKey", ctx, id)} +} + +func (_c *ClientEncryption_GetKey_Call) Run(run func(ctx context.Context, id primitive.Binary)) *ClientEncryption_GetKey_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(primitive.Binary)) + }) + return _c +} + +func (_c *ClientEncryption_GetKey_Call) Return(_a0 mongoifc.SingleResult) *ClientEncryption_GetKey_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ClientEncryption_GetKey_Call) RunAndReturn(run func(context.Context, primitive.Binary) mongoifc.SingleResult) *ClientEncryption_GetKey_Call { + _c.Call.Return(run) + return _c +} + // GetKeyByAltName provides a mock function with given fields: ctx, keyAltName func (_m *ClientEncryption) GetKeyByAltName(ctx context.Context, keyAltName string) mongoifc.SingleResult { ret := _m.Called(ctx, keyAltName) @@ -253,6 +551,35 @@ func (_m *ClientEncryption) GetKeyByAltName(ctx context.Context, keyAltName stri return r0 } +// ClientEncryption_GetKeyByAltName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetKeyByAltName' +type ClientEncryption_GetKeyByAltName_Call struct { + *mock.Call +} + +// GetKeyByAltName is a helper method to define mock.On call +// - ctx context.Context +// - keyAltName string +func (_e *ClientEncryption_Expecter) GetKeyByAltName(ctx interface{}, keyAltName interface{}) *ClientEncryption_GetKeyByAltName_Call { + return &ClientEncryption_GetKeyByAltName_Call{Call: _e.mock.On("GetKeyByAltName", ctx, keyAltName)} +} + +func (_c *ClientEncryption_GetKeyByAltName_Call) Run(run func(ctx context.Context, keyAltName string)) *ClientEncryption_GetKeyByAltName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *ClientEncryption_GetKeyByAltName_Call) Return(_a0 mongoifc.SingleResult) *ClientEncryption_GetKeyByAltName_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ClientEncryption_GetKeyByAltName_Call) RunAndReturn(run func(context.Context, string) mongoifc.SingleResult) *ClientEncryption_GetKeyByAltName_Call { + _c.Call.Return(run) + return _c +} + // GetKeys provides a mock function with given fields: ctx func (_m *ClientEncryption) GetKeys(ctx context.Context) (mongoifc.Cursor, error) { ret := _m.Called(ctx) @@ -279,6 +606,34 @@ func (_m *ClientEncryption) GetKeys(ctx context.Context) (mongoifc.Cursor, error return r0, r1 } +// ClientEncryption_GetKeys_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetKeys' +type ClientEncryption_GetKeys_Call struct { + *mock.Call +} + +// GetKeys is a helper method to define mock.On call +// - ctx context.Context +func (_e *ClientEncryption_Expecter) GetKeys(ctx interface{}) *ClientEncryption_GetKeys_Call { + return &ClientEncryption_GetKeys_Call{Call: _e.mock.On("GetKeys", ctx)} +} + +func (_c *ClientEncryption_GetKeys_Call) Run(run func(ctx context.Context)) *ClientEncryption_GetKeys_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *ClientEncryption_GetKeys_Call) Return(_a0 mongoifc.Cursor, _a1 error) *ClientEncryption_GetKeys_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ClientEncryption_GetKeys_Call) RunAndReturn(run func(context.Context) (mongoifc.Cursor, error)) *ClientEncryption_GetKeys_Call { + _c.Call.Return(run) + return _c +} + // RemoveKeyAltName provides a mock function with given fields: ctx, id, keyAltName func (_m *ClientEncryption) RemoveKeyAltName(ctx context.Context, id primitive.Binary, keyAltName string) mongoifc.SingleResult { ret := _m.Called(ctx, id, keyAltName) @@ -295,6 +650,36 @@ func (_m *ClientEncryption) RemoveKeyAltName(ctx context.Context, id primitive.B return r0 } +// ClientEncryption_RemoveKeyAltName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveKeyAltName' +type ClientEncryption_RemoveKeyAltName_Call struct { + *mock.Call +} + +// RemoveKeyAltName is a helper method to define mock.On call +// - ctx context.Context +// - id primitive.Binary +// - keyAltName string +func (_e *ClientEncryption_Expecter) RemoveKeyAltName(ctx interface{}, id interface{}, keyAltName interface{}) *ClientEncryption_RemoveKeyAltName_Call { + return &ClientEncryption_RemoveKeyAltName_Call{Call: _e.mock.On("RemoveKeyAltName", ctx, id, keyAltName)} +} + +func (_c *ClientEncryption_RemoveKeyAltName_Call) Run(run func(ctx context.Context, id primitive.Binary, keyAltName string)) *ClientEncryption_RemoveKeyAltName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(primitive.Binary), args[2].(string)) + }) + return _c +} + +func (_c *ClientEncryption_RemoveKeyAltName_Call) Return(_a0 mongoifc.SingleResult) *ClientEncryption_RemoveKeyAltName_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ClientEncryption_RemoveKeyAltName_Call) RunAndReturn(run func(context.Context, primitive.Binary, string) mongoifc.SingleResult) *ClientEncryption_RemoveKeyAltName_Call { + _c.Call.Return(run) + return _c +} + // RewrapManyDataKey provides a mock function with given fields: ctx, filter, opts func (_m *ClientEncryption) RewrapManyDataKey(ctx context.Context, filter interface{}, opts ...*options.RewrapManyDataKeyOptions) (*mongo.RewrapManyDataKeyResult, error) { _va := make([]interface{}, len(opts)) @@ -328,6 +713,43 @@ func (_m *ClientEncryption) RewrapManyDataKey(ctx context.Context, filter interf return r0, r1 } +// ClientEncryption_RewrapManyDataKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RewrapManyDataKey' +type ClientEncryption_RewrapManyDataKey_Call struct { + *mock.Call +} + +// RewrapManyDataKey is a helper method to define mock.On call +// - ctx context.Context +// - filter interface{} +// - opts ...*options.RewrapManyDataKeyOptions +func (_e *ClientEncryption_Expecter) RewrapManyDataKey(ctx interface{}, filter interface{}, opts ...interface{}) *ClientEncryption_RewrapManyDataKey_Call { + return &ClientEncryption_RewrapManyDataKey_Call{Call: _e.mock.On("RewrapManyDataKey", + append([]interface{}{ctx, filter}, opts...)...)} +} + +func (_c *ClientEncryption_RewrapManyDataKey_Call) Run(run func(ctx context.Context, filter interface{}, opts ...*options.RewrapManyDataKeyOptions)) *ClientEncryption_RewrapManyDataKey_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.RewrapManyDataKeyOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.RewrapManyDataKeyOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *ClientEncryption_RewrapManyDataKey_Call) Return(_a0 *mongo.RewrapManyDataKeyResult, _a1 error) *ClientEncryption_RewrapManyDataKey_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ClientEncryption_RewrapManyDataKey_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.RewrapManyDataKeyOptions) (*mongo.RewrapManyDataKeyResult, error)) *ClientEncryption_RewrapManyDataKey_Call { + _c.Call.Return(run) + return _c +} + // NewClientEncryption creates a new instance of ClientEncryption. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewClientEncryption(t interface { diff --git a/mocks/mockery/collection.go b/mocks/mockery/collection.go index 073de95..a43ee12 100644 --- a/mocks/mockery/collection.go +++ b/mocks/mockery/collection.go @@ -18,6 +18,14 @@ type Collection struct { mock.Mock } +type Collection_Expecter struct { + mock *mock.Mock +} + +func (_m *Collection) EXPECT() *Collection_Expecter { + return &Collection_Expecter{mock: &_m.Mock} +} + // Aggregate provides a mock function with given fields: ctx, pipeline, opts func (_m *Collection) Aggregate(ctx context.Context, pipeline interface{}, opts ...*options.AggregateOptions) (mongoifc.Cursor, error) { _va := make([]interface{}, len(opts)) @@ -51,6 +59,43 @@ func (_m *Collection) Aggregate(ctx context.Context, pipeline interface{}, opts return r0, r1 } +// Collection_Aggregate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Aggregate' +type Collection_Aggregate_Call struct { + *mock.Call +} + +// Aggregate is a helper method to define mock.On call +// - ctx context.Context +// - pipeline interface{} +// - opts ...*options.AggregateOptions +func (_e *Collection_Expecter) Aggregate(ctx interface{}, pipeline interface{}, opts ...interface{}) *Collection_Aggregate_Call { + return &Collection_Aggregate_Call{Call: _e.mock.On("Aggregate", + append([]interface{}{ctx, pipeline}, opts...)...)} +} + +func (_c *Collection_Aggregate_Call) Run(run func(ctx context.Context, pipeline interface{}, opts ...*options.AggregateOptions)) *Collection_Aggregate_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.AggregateOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.AggregateOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Collection_Aggregate_Call) Return(_a0 mongoifc.Cursor, _a1 error) *Collection_Aggregate_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Collection_Aggregate_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.AggregateOptions) (mongoifc.Cursor, error)) *Collection_Aggregate_Call { + _c.Call.Return(run) + return _c +} + // BulkWrite provides a mock function with given fields: ctx, models, opts func (_m *Collection) BulkWrite(ctx context.Context, models []mongo.WriteModel, opts ...*options.BulkWriteOptions) (*mongo.BulkWriteResult, error) { _va := make([]interface{}, len(opts)) @@ -84,6 +129,43 @@ func (_m *Collection) BulkWrite(ctx context.Context, models []mongo.WriteModel, return r0, r1 } +// Collection_BulkWrite_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BulkWrite' +type Collection_BulkWrite_Call struct { + *mock.Call +} + +// BulkWrite is a helper method to define mock.On call +// - ctx context.Context +// - models []mongo.WriteModel +// - opts ...*options.BulkWriteOptions +func (_e *Collection_Expecter) BulkWrite(ctx interface{}, models interface{}, opts ...interface{}) *Collection_BulkWrite_Call { + return &Collection_BulkWrite_Call{Call: _e.mock.On("BulkWrite", + append([]interface{}{ctx, models}, opts...)...)} +} + +func (_c *Collection_BulkWrite_Call) Run(run func(ctx context.Context, models []mongo.WriteModel, opts ...*options.BulkWriteOptions)) *Collection_BulkWrite_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.BulkWriteOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.BulkWriteOptions) + } + } + run(args[0].(context.Context), args[1].([]mongo.WriteModel), variadicArgs...) + }) + return _c +} + +func (_c *Collection_BulkWrite_Call) Return(_a0 *mongo.BulkWriteResult, _a1 error) *Collection_BulkWrite_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Collection_BulkWrite_Call) RunAndReturn(run func(context.Context, []mongo.WriteModel, ...*options.BulkWriteOptions) (*mongo.BulkWriteResult, error)) *Collection_BulkWrite_Call { + _c.Call.Return(run) + return _c +} + // Clone provides a mock function with given fields: opts func (_m *Collection) Clone(opts ...*options.CollectionOptions) (mongoifc.Collection, error) { _va := make([]interface{}, len(opts)) @@ -116,6 +198,41 @@ func (_m *Collection) Clone(opts ...*options.CollectionOptions) (mongoifc.Collec return r0, r1 } +// Collection_Clone_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Clone' +type Collection_Clone_Call struct { + *mock.Call +} + +// Clone is a helper method to define mock.On call +// - opts ...*options.CollectionOptions +func (_e *Collection_Expecter) Clone(opts ...interface{}) *Collection_Clone_Call { + return &Collection_Clone_Call{Call: _e.mock.On("Clone", + append([]interface{}{}, opts...)...)} +} + +func (_c *Collection_Clone_Call) Run(run func(opts ...*options.CollectionOptions)) *Collection_Clone_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.CollectionOptions, len(args)-0) + for i, a := range args[0:] { + if a != nil { + variadicArgs[i] = a.(*options.CollectionOptions) + } + } + run(variadicArgs...) + }) + return _c +} + +func (_c *Collection_Clone_Call) Return(_a0 mongoifc.Collection, _a1 error) *Collection_Clone_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Collection_Clone_Call) RunAndReturn(run func(...*options.CollectionOptions) (mongoifc.Collection, error)) *Collection_Clone_Call { + _c.Call.Return(run) + return _c +} + // CountDocuments provides a mock function with given fields: ctx, filter, opts func (_m *Collection) CountDocuments(ctx context.Context, filter interface{}, opts ...*options.CountOptions) (int64, error) { _va := make([]interface{}, len(opts)) @@ -147,6 +264,43 @@ func (_m *Collection) CountDocuments(ctx context.Context, filter interface{}, op return r0, r1 } +// Collection_CountDocuments_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CountDocuments' +type Collection_CountDocuments_Call struct { + *mock.Call +} + +// CountDocuments is a helper method to define mock.On call +// - ctx context.Context +// - filter interface{} +// - opts ...*options.CountOptions +func (_e *Collection_Expecter) CountDocuments(ctx interface{}, filter interface{}, opts ...interface{}) *Collection_CountDocuments_Call { + return &Collection_CountDocuments_Call{Call: _e.mock.On("CountDocuments", + append([]interface{}{ctx, filter}, opts...)...)} +} + +func (_c *Collection_CountDocuments_Call) Run(run func(ctx context.Context, filter interface{}, opts ...*options.CountOptions)) *Collection_CountDocuments_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.CountOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.CountOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Collection_CountDocuments_Call) Return(_a0 int64, _a1 error) *Collection_CountDocuments_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Collection_CountDocuments_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.CountOptions) (int64, error)) *Collection_CountDocuments_Call { + _c.Call.Return(run) + return _c +} + // Database provides a mock function with given fields: func (_m *Collection) Database() mongoifc.Database { ret := _m.Called() @@ -163,6 +317,33 @@ func (_m *Collection) Database() mongoifc.Database { return r0 } +// Collection_Database_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Database' +type Collection_Database_Call struct { + *mock.Call +} + +// Database is a helper method to define mock.On call +func (_e *Collection_Expecter) Database() *Collection_Database_Call { + return &Collection_Database_Call{Call: _e.mock.On("Database")} +} + +func (_c *Collection_Database_Call) Run(run func()) *Collection_Database_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Collection_Database_Call) Return(_a0 mongoifc.Database) *Collection_Database_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Collection_Database_Call) RunAndReturn(run func() mongoifc.Database) *Collection_Database_Call { + _c.Call.Return(run) + return _c +} + // DeleteMany provides a mock function with given fields: ctx, filter, opts func (_m *Collection) DeleteMany(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error) { _va := make([]interface{}, len(opts)) @@ -196,6 +377,43 @@ func (_m *Collection) DeleteMany(ctx context.Context, filter interface{}, opts . return r0, r1 } +// Collection_DeleteMany_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteMany' +type Collection_DeleteMany_Call struct { + *mock.Call +} + +// DeleteMany is a helper method to define mock.On call +// - ctx context.Context +// - filter interface{} +// - opts ...*options.DeleteOptions +func (_e *Collection_Expecter) DeleteMany(ctx interface{}, filter interface{}, opts ...interface{}) *Collection_DeleteMany_Call { + return &Collection_DeleteMany_Call{Call: _e.mock.On("DeleteMany", + append([]interface{}{ctx, filter}, opts...)...)} +} + +func (_c *Collection_DeleteMany_Call) Run(run func(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions)) *Collection_DeleteMany_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.DeleteOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.DeleteOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Collection_DeleteMany_Call) Return(_a0 *mongo.DeleteResult, _a1 error) *Collection_DeleteMany_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Collection_DeleteMany_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.DeleteOptions) (*mongo.DeleteResult, error)) *Collection_DeleteMany_Call { + _c.Call.Return(run) + return _c +} + // DeleteOne provides a mock function with given fields: ctx, filter, opts func (_m *Collection) DeleteOne(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error) { _va := make([]interface{}, len(opts)) @@ -229,6 +447,43 @@ func (_m *Collection) DeleteOne(ctx context.Context, filter interface{}, opts .. return r0, r1 } +// Collection_DeleteOne_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteOne' +type Collection_DeleteOne_Call struct { + *mock.Call +} + +// DeleteOne is a helper method to define mock.On call +// - ctx context.Context +// - filter interface{} +// - opts ...*options.DeleteOptions +func (_e *Collection_Expecter) DeleteOne(ctx interface{}, filter interface{}, opts ...interface{}) *Collection_DeleteOne_Call { + return &Collection_DeleteOne_Call{Call: _e.mock.On("DeleteOne", + append([]interface{}{ctx, filter}, opts...)...)} +} + +func (_c *Collection_DeleteOne_Call) Run(run func(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions)) *Collection_DeleteOne_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.DeleteOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.DeleteOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Collection_DeleteOne_Call) Return(_a0 *mongo.DeleteResult, _a1 error) *Collection_DeleteOne_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Collection_DeleteOne_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.DeleteOptions) (*mongo.DeleteResult, error)) *Collection_DeleteOne_Call { + _c.Call.Return(run) + return _c +} + // Distinct provides a mock function with given fields: ctx, fieldName, filter, opts func (_m *Collection) Distinct(ctx context.Context, fieldName string, filter interface{}, opts ...*options.DistinctOptions) ([]interface{}, error) { _va := make([]interface{}, len(opts)) @@ -262,6 +517,44 @@ func (_m *Collection) Distinct(ctx context.Context, fieldName string, filter int return r0, r1 } +// Collection_Distinct_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Distinct' +type Collection_Distinct_Call struct { + *mock.Call +} + +// Distinct is a helper method to define mock.On call +// - ctx context.Context +// - fieldName string +// - filter interface{} +// - opts ...*options.DistinctOptions +func (_e *Collection_Expecter) Distinct(ctx interface{}, fieldName interface{}, filter interface{}, opts ...interface{}) *Collection_Distinct_Call { + return &Collection_Distinct_Call{Call: _e.mock.On("Distinct", + append([]interface{}{ctx, fieldName, filter}, opts...)...)} +} + +func (_c *Collection_Distinct_Call) Run(run func(ctx context.Context, fieldName string, filter interface{}, opts ...*options.DistinctOptions)) *Collection_Distinct_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.DistinctOptions, len(args)-3) + for i, a := range args[3:] { + if a != nil { + variadicArgs[i] = a.(*options.DistinctOptions) + } + } + run(args[0].(context.Context), args[1].(string), args[2].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Collection_Distinct_Call) Return(_a0 []interface{}, _a1 error) *Collection_Distinct_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Collection_Distinct_Call) RunAndReturn(run func(context.Context, string, interface{}, ...*options.DistinctOptions) ([]interface{}, error)) *Collection_Distinct_Call { + _c.Call.Return(run) + return _c +} + // Drop provides a mock function with given fields: ctx func (_m *Collection) Drop(ctx context.Context) error { ret := _m.Called(ctx) @@ -276,6 +569,34 @@ func (_m *Collection) Drop(ctx context.Context) error { return r0 } +// Collection_Drop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Drop' +type Collection_Drop_Call struct { + *mock.Call +} + +// Drop is a helper method to define mock.On call +// - ctx context.Context +func (_e *Collection_Expecter) Drop(ctx interface{}) *Collection_Drop_Call { + return &Collection_Drop_Call{Call: _e.mock.On("Drop", ctx)} +} + +func (_c *Collection_Drop_Call) Run(run func(ctx context.Context)) *Collection_Drop_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Collection_Drop_Call) Return(_a0 error) *Collection_Drop_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Collection_Drop_Call) RunAndReturn(run func(context.Context) error) *Collection_Drop_Call { + _c.Call.Return(run) + return _c +} + // EstimatedDocumentCount provides a mock function with given fields: ctx, opts func (_m *Collection) EstimatedDocumentCount(ctx context.Context, opts ...*options.EstimatedDocumentCountOptions) (int64, error) { _va := make([]interface{}, len(opts)) @@ -307,6 +628,42 @@ func (_m *Collection) EstimatedDocumentCount(ctx context.Context, opts ...*optio return r0, r1 } +// Collection_EstimatedDocumentCount_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EstimatedDocumentCount' +type Collection_EstimatedDocumentCount_Call struct { + *mock.Call +} + +// EstimatedDocumentCount is a helper method to define mock.On call +// - ctx context.Context +// - opts ...*options.EstimatedDocumentCountOptions +func (_e *Collection_Expecter) EstimatedDocumentCount(ctx interface{}, opts ...interface{}) *Collection_EstimatedDocumentCount_Call { + return &Collection_EstimatedDocumentCount_Call{Call: _e.mock.On("EstimatedDocumentCount", + append([]interface{}{ctx}, opts...)...)} +} + +func (_c *Collection_EstimatedDocumentCount_Call) Run(run func(ctx context.Context, opts ...*options.EstimatedDocumentCountOptions)) *Collection_EstimatedDocumentCount_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.EstimatedDocumentCountOptions, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(*options.EstimatedDocumentCountOptions) + } + } + run(args[0].(context.Context), variadicArgs...) + }) + return _c +} + +func (_c *Collection_EstimatedDocumentCount_Call) Return(_a0 int64, _a1 error) *Collection_EstimatedDocumentCount_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Collection_EstimatedDocumentCount_Call) RunAndReturn(run func(context.Context, ...*options.EstimatedDocumentCountOptions) (int64, error)) *Collection_EstimatedDocumentCount_Call { + _c.Call.Return(run) + return _c +} + // Find provides a mock function with given fields: ctx, filter, opts func (_m *Collection) Find(ctx context.Context, filter interface{}, opts ...*options.FindOptions) (mongoifc.Cursor, error) { _va := make([]interface{}, len(opts)) @@ -340,6 +697,43 @@ func (_m *Collection) Find(ctx context.Context, filter interface{}, opts ...*opt return r0, r1 } +// Collection_Find_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Find' +type Collection_Find_Call struct { + *mock.Call +} + +// Find is a helper method to define mock.On call +// - ctx context.Context +// - filter interface{} +// - opts ...*options.FindOptions +func (_e *Collection_Expecter) Find(ctx interface{}, filter interface{}, opts ...interface{}) *Collection_Find_Call { + return &Collection_Find_Call{Call: _e.mock.On("Find", + append([]interface{}{ctx, filter}, opts...)...)} +} + +func (_c *Collection_Find_Call) Run(run func(ctx context.Context, filter interface{}, opts ...*options.FindOptions)) *Collection_Find_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.FindOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.FindOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Collection_Find_Call) Return(_a0 mongoifc.Cursor, _a1 error) *Collection_Find_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Collection_Find_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.FindOptions) (mongoifc.Cursor, error)) *Collection_Find_Call { + _c.Call.Return(run) + return _c +} + // FindOne provides a mock function with given fields: ctx, filter, opts func (_m *Collection) FindOne(ctx context.Context, filter interface{}, opts ...*options.FindOneOptions) mongoifc.SingleResult { _va := make([]interface{}, len(opts)) @@ -363,6 +757,43 @@ func (_m *Collection) FindOne(ctx context.Context, filter interface{}, opts ...* return r0 } +// Collection_FindOne_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindOne' +type Collection_FindOne_Call struct { + *mock.Call +} + +// FindOne is a helper method to define mock.On call +// - ctx context.Context +// - filter interface{} +// - opts ...*options.FindOneOptions +func (_e *Collection_Expecter) FindOne(ctx interface{}, filter interface{}, opts ...interface{}) *Collection_FindOne_Call { + return &Collection_FindOne_Call{Call: _e.mock.On("FindOne", + append([]interface{}{ctx, filter}, opts...)...)} +} + +func (_c *Collection_FindOne_Call) Run(run func(ctx context.Context, filter interface{}, opts ...*options.FindOneOptions)) *Collection_FindOne_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.FindOneOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.FindOneOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Collection_FindOne_Call) Return(_a0 mongoifc.SingleResult) *Collection_FindOne_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Collection_FindOne_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.FindOneOptions) mongoifc.SingleResult) *Collection_FindOne_Call { + _c.Call.Return(run) + return _c +} + // FindOneAndDelete provides a mock function with given fields: ctx, filter, opts func (_m *Collection) FindOneAndDelete(ctx context.Context, filter interface{}, opts ...*options.FindOneAndDeleteOptions) mongoifc.SingleResult { _va := make([]interface{}, len(opts)) @@ -386,6 +817,43 @@ func (_m *Collection) FindOneAndDelete(ctx context.Context, filter interface{}, return r0 } +// Collection_FindOneAndDelete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindOneAndDelete' +type Collection_FindOneAndDelete_Call struct { + *mock.Call +} + +// FindOneAndDelete is a helper method to define mock.On call +// - ctx context.Context +// - filter interface{} +// - opts ...*options.FindOneAndDeleteOptions +func (_e *Collection_Expecter) FindOneAndDelete(ctx interface{}, filter interface{}, opts ...interface{}) *Collection_FindOneAndDelete_Call { + return &Collection_FindOneAndDelete_Call{Call: _e.mock.On("FindOneAndDelete", + append([]interface{}{ctx, filter}, opts...)...)} +} + +func (_c *Collection_FindOneAndDelete_Call) Run(run func(ctx context.Context, filter interface{}, opts ...*options.FindOneAndDeleteOptions)) *Collection_FindOneAndDelete_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.FindOneAndDeleteOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.FindOneAndDeleteOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Collection_FindOneAndDelete_Call) Return(_a0 mongoifc.SingleResult) *Collection_FindOneAndDelete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Collection_FindOneAndDelete_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.FindOneAndDeleteOptions) mongoifc.SingleResult) *Collection_FindOneAndDelete_Call { + _c.Call.Return(run) + return _c +} + // FindOneAndReplace provides a mock function with given fields: ctx, filter, replacement, opts func (_m *Collection) FindOneAndReplace(ctx context.Context, filter interface{}, replacement interface{}, opts ...*options.FindOneAndReplaceOptions) mongoifc.SingleResult { _va := make([]interface{}, len(opts)) @@ -409,6 +877,44 @@ func (_m *Collection) FindOneAndReplace(ctx context.Context, filter interface{}, return r0 } +// Collection_FindOneAndReplace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindOneAndReplace' +type Collection_FindOneAndReplace_Call struct { + *mock.Call +} + +// FindOneAndReplace is a helper method to define mock.On call +// - ctx context.Context +// - filter interface{} +// - replacement interface{} +// - opts ...*options.FindOneAndReplaceOptions +func (_e *Collection_Expecter) FindOneAndReplace(ctx interface{}, filter interface{}, replacement interface{}, opts ...interface{}) *Collection_FindOneAndReplace_Call { + return &Collection_FindOneAndReplace_Call{Call: _e.mock.On("FindOneAndReplace", + append([]interface{}{ctx, filter, replacement}, opts...)...)} +} + +func (_c *Collection_FindOneAndReplace_Call) Run(run func(ctx context.Context, filter interface{}, replacement interface{}, opts ...*options.FindOneAndReplaceOptions)) *Collection_FindOneAndReplace_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.FindOneAndReplaceOptions, len(args)-3) + for i, a := range args[3:] { + if a != nil { + variadicArgs[i] = a.(*options.FindOneAndReplaceOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), args[2].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Collection_FindOneAndReplace_Call) Return(_a0 mongoifc.SingleResult) *Collection_FindOneAndReplace_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Collection_FindOneAndReplace_Call) RunAndReturn(run func(context.Context, interface{}, interface{}, ...*options.FindOneAndReplaceOptions) mongoifc.SingleResult) *Collection_FindOneAndReplace_Call { + _c.Call.Return(run) + return _c +} + // FindOneAndUpdate provides a mock function with given fields: ctx, filter, update, opts func (_m *Collection) FindOneAndUpdate(ctx context.Context, filter interface{}, update interface{}, opts ...*options.FindOneAndUpdateOptions) mongoifc.SingleResult { _va := make([]interface{}, len(opts)) @@ -432,6 +938,44 @@ func (_m *Collection) FindOneAndUpdate(ctx context.Context, filter interface{}, return r0 } +// Collection_FindOneAndUpdate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindOneAndUpdate' +type Collection_FindOneAndUpdate_Call struct { + *mock.Call +} + +// FindOneAndUpdate is a helper method to define mock.On call +// - ctx context.Context +// - filter interface{} +// - update interface{} +// - opts ...*options.FindOneAndUpdateOptions +func (_e *Collection_Expecter) FindOneAndUpdate(ctx interface{}, filter interface{}, update interface{}, opts ...interface{}) *Collection_FindOneAndUpdate_Call { + return &Collection_FindOneAndUpdate_Call{Call: _e.mock.On("FindOneAndUpdate", + append([]interface{}{ctx, filter, update}, opts...)...)} +} + +func (_c *Collection_FindOneAndUpdate_Call) Run(run func(ctx context.Context, filter interface{}, update interface{}, opts ...*options.FindOneAndUpdateOptions)) *Collection_FindOneAndUpdate_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.FindOneAndUpdateOptions, len(args)-3) + for i, a := range args[3:] { + if a != nil { + variadicArgs[i] = a.(*options.FindOneAndUpdateOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), args[2].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Collection_FindOneAndUpdate_Call) Return(_a0 mongoifc.SingleResult) *Collection_FindOneAndUpdate_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Collection_FindOneAndUpdate_Call) RunAndReturn(run func(context.Context, interface{}, interface{}, ...*options.FindOneAndUpdateOptions) mongoifc.SingleResult) *Collection_FindOneAndUpdate_Call { + _c.Call.Return(run) + return _c +} + // Indexes provides a mock function with given fields: func (_m *Collection) Indexes() mongoifc.IndexView { ret := _m.Called() @@ -448,6 +992,33 @@ func (_m *Collection) Indexes() mongoifc.IndexView { return r0 } +// Collection_Indexes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Indexes' +type Collection_Indexes_Call struct { + *mock.Call +} + +// Indexes is a helper method to define mock.On call +func (_e *Collection_Expecter) Indexes() *Collection_Indexes_Call { + return &Collection_Indexes_Call{Call: _e.mock.On("Indexes")} +} + +func (_c *Collection_Indexes_Call) Run(run func()) *Collection_Indexes_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Collection_Indexes_Call) Return(_a0 mongoifc.IndexView) *Collection_Indexes_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Collection_Indexes_Call) RunAndReturn(run func() mongoifc.IndexView) *Collection_Indexes_Call { + _c.Call.Return(run) + return _c +} + // InsertMany provides a mock function with given fields: ctx, documents, opts func (_m *Collection) InsertMany(ctx context.Context, documents []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error) { _va := make([]interface{}, len(opts)) @@ -481,6 +1052,43 @@ func (_m *Collection) InsertMany(ctx context.Context, documents []interface{}, o return r0, r1 } +// Collection_InsertMany_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InsertMany' +type Collection_InsertMany_Call struct { + *mock.Call +} + +// InsertMany is a helper method to define mock.On call +// - ctx context.Context +// - documents []interface{} +// - opts ...*options.InsertManyOptions +func (_e *Collection_Expecter) InsertMany(ctx interface{}, documents interface{}, opts ...interface{}) *Collection_InsertMany_Call { + return &Collection_InsertMany_Call{Call: _e.mock.On("InsertMany", + append([]interface{}{ctx, documents}, opts...)...)} +} + +func (_c *Collection_InsertMany_Call) Run(run func(ctx context.Context, documents []interface{}, opts ...*options.InsertManyOptions)) *Collection_InsertMany_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.InsertManyOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.InsertManyOptions) + } + } + run(args[0].(context.Context), args[1].([]interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Collection_InsertMany_Call) Return(_a0 *mongo.InsertManyResult, _a1 error) *Collection_InsertMany_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Collection_InsertMany_Call) RunAndReturn(run func(context.Context, []interface{}, ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)) *Collection_InsertMany_Call { + _c.Call.Return(run) + return _c +} + // InsertOne provides a mock function with given fields: ctx, document, opts func (_m *Collection) InsertOne(ctx context.Context, document interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error) { _va := make([]interface{}, len(opts)) @@ -514,6 +1122,43 @@ func (_m *Collection) InsertOne(ctx context.Context, document interface{}, opts return r0, r1 } +// Collection_InsertOne_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InsertOne' +type Collection_InsertOne_Call struct { + *mock.Call +} + +// InsertOne is a helper method to define mock.On call +// - ctx context.Context +// - document interface{} +// - opts ...*options.InsertOneOptions +func (_e *Collection_Expecter) InsertOne(ctx interface{}, document interface{}, opts ...interface{}) *Collection_InsertOne_Call { + return &Collection_InsertOne_Call{Call: _e.mock.On("InsertOne", + append([]interface{}{ctx, document}, opts...)...)} +} + +func (_c *Collection_InsertOne_Call) Run(run func(ctx context.Context, document interface{}, opts ...*options.InsertOneOptions)) *Collection_InsertOne_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.InsertOneOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.InsertOneOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Collection_InsertOne_Call) Return(_a0 *mongo.InsertOneResult, _a1 error) *Collection_InsertOne_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Collection_InsertOne_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)) *Collection_InsertOne_Call { + _c.Call.Return(run) + return _c +} + // Name provides a mock function with given fields: func (_m *Collection) Name() string { ret := _m.Called() @@ -528,6 +1173,33 @@ func (_m *Collection) Name() string { return r0 } +// Collection_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' +type Collection_Name_Call struct { + *mock.Call +} + +// Name is a helper method to define mock.On call +func (_e *Collection_Expecter) Name() *Collection_Name_Call { + return &Collection_Name_Call{Call: _e.mock.On("Name")} +} + +func (_c *Collection_Name_Call) Run(run func()) *Collection_Name_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Collection_Name_Call) Return(_a0 string) *Collection_Name_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Collection_Name_Call) RunAndReturn(run func() string) *Collection_Name_Call { + _c.Call.Return(run) + return _c +} + // ReplaceOne provides a mock function with given fields: ctx, filter, replacement, opts func (_m *Collection) ReplaceOne(ctx context.Context, filter interface{}, replacement interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error) { _va := make([]interface{}, len(opts)) @@ -561,6 +1233,44 @@ func (_m *Collection) ReplaceOne(ctx context.Context, filter interface{}, replac return r0, r1 } +// Collection_ReplaceOne_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReplaceOne' +type Collection_ReplaceOne_Call struct { + *mock.Call +} + +// ReplaceOne is a helper method to define mock.On call +// - ctx context.Context +// - filter interface{} +// - replacement interface{} +// - opts ...*options.ReplaceOptions +func (_e *Collection_Expecter) ReplaceOne(ctx interface{}, filter interface{}, replacement interface{}, opts ...interface{}) *Collection_ReplaceOne_Call { + return &Collection_ReplaceOne_Call{Call: _e.mock.On("ReplaceOne", + append([]interface{}{ctx, filter, replacement}, opts...)...)} +} + +func (_c *Collection_ReplaceOne_Call) Run(run func(ctx context.Context, filter interface{}, replacement interface{}, opts ...*options.ReplaceOptions)) *Collection_ReplaceOne_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.ReplaceOptions, len(args)-3) + for i, a := range args[3:] { + if a != nil { + variadicArgs[i] = a.(*options.ReplaceOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), args[2].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Collection_ReplaceOne_Call) Return(_a0 *mongo.UpdateResult, _a1 error) *Collection_ReplaceOne_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Collection_ReplaceOne_Call) RunAndReturn(run func(context.Context, interface{}, interface{}, ...*options.ReplaceOptions) (*mongo.UpdateResult, error)) *Collection_ReplaceOne_Call { + _c.Call.Return(run) + return _c +} + // UpdateByID provides a mock function with given fields: ctx, id, update, opts func (_m *Collection) UpdateByID(ctx context.Context, id interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error) { _va := make([]interface{}, len(opts)) @@ -594,6 +1304,44 @@ func (_m *Collection) UpdateByID(ctx context.Context, id interface{}, update int return r0, r1 } +// Collection_UpdateByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateByID' +type Collection_UpdateByID_Call struct { + *mock.Call +} + +// UpdateByID is a helper method to define mock.On call +// - ctx context.Context +// - id interface{} +// - update interface{} +// - opts ...*options.UpdateOptions +func (_e *Collection_Expecter) UpdateByID(ctx interface{}, id interface{}, update interface{}, opts ...interface{}) *Collection_UpdateByID_Call { + return &Collection_UpdateByID_Call{Call: _e.mock.On("UpdateByID", + append([]interface{}{ctx, id, update}, opts...)...)} +} + +func (_c *Collection_UpdateByID_Call) Run(run func(ctx context.Context, id interface{}, update interface{}, opts ...*options.UpdateOptions)) *Collection_UpdateByID_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.UpdateOptions, len(args)-3) + for i, a := range args[3:] { + if a != nil { + variadicArgs[i] = a.(*options.UpdateOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), args[2].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Collection_UpdateByID_Call) Return(_a0 *mongo.UpdateResult, _a1 error) *Collection_UpdateByID_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Collection_UpdateByID_Call) RunAndReturn(run func(context.Context, interface{}, interface{}, ...*options.UpdateOptions) (*mongo.UpdateResult, error)) *Collection_UpdateByID_Call { + _c.Call.Return(run) + return _c +} + // UpdateMany provides a mock function with given fields: ctx, filter, update, opts func (_m *Collection) UpdateMany(ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error) { _va := make([]interface{}, len(opts)) @@ -627,6 +1375,44 @@ func (_m *Collection) UpdateMany(ctx context.Context, filter interface{}, update return r0, r1 } +// Collection_UpdateMany_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateMany' +type Collection_UpdateMany_Call struct { + *mock.Call +} + +// UpdateMany is a helper method to define mock.On call +// - ctx context.Context +// - filter interface{} +// - update interface{} +// - opts ...*options.UpdateOptions +func (_e *Collection_Expecter) UpdateMany(ctx interface{}, filter interface{}, update interface{}, opts ...interface{}) *Collection_UpdateMany_Call { + return &Collection_UpdateMany_Call{Call: _e.mock.On("UpdateMany", + append([]interface{}{ctx, filter, update}, opts...)...)} +} + +func (_c *Collection_UpdateMany_Call) Run(run func(ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions)) *Collection_UpdateMany_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.UpdateOptions, len(args)-3) + for i, a := range args[3:] { + if a != nil { + variadicArgs[i] = a.(*options.UpdateOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), args[2].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Collection_UpdateMany_Call) Return(_a0 *mongo.UpdateResult, _a1 error) *Collection_UpdateMany_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Collection_UpdateMany_Call) RunAndReturn(run func(context.Context, interface{}, interface{}, ...*options.UpdateOptions) (*mongo.UpdateResult, error)) *Collection_UpdateMany_Call { + _c.Call.Return(run) + return _c +} + // UpdateOne provides a mock function with given fields: ctx, filter, update, opts func (_m *Collection) UpdateOne(ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error) { _va := make([]interface{}, len(opts)) @@ -660,6 +1446,44 @@ func (_m *Collection) UpdateOne(ctx context.Context, filter interface{}, update return r0, r1 } +// Collection_UpdateOne_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateOne' +type Collection_UpdateOne_Call struct { + *mock.Call +} + +// UpdateOne is a helper method to define mock.On call +// - ctx context.Context +// - filter interface{} +// - update interface{} +// - opts ...*options.UpdateOptions +func (_e *Collection_Expecter) UpdateOne(ctx interface{}, filter interface{}, update interface{}, opts ...interface{}) *Collection_UpdateOne_Call { + return &Collection_UpdateOne_Call{Call: _e.mock.On("UpdateOne", + append([]interface{}{ctx, filter, update}, opts...)...)} +} + +func (_c *Collection_UpdateOne_Call) Run(run func(ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions)) *Collection_UpdateOne_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.UpdateOptions, len(args)-3) + for i, a := range args[3:] { + if a != nil { + variadicArgs[i] = a.(*options.UpdateOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), args[2].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Collection_UpdateOne_Call) Return(_a0 *mongo.UpdateResult, _a1 error) *Collection_UpdateOne_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Collection_UpdateOne_Call) RunAndReturn(run func(context.Context, interface{}, interface{}, ...*options.UpdateOptions) (*mongo.UpdateResult, error)) *Collection_UpdateOne_Call { + _c.Call.Return(run) + return _c +} + // Watch provides a mock function with given fields: ctx, pipeline, opts func (_m *Collection) Watch(ctx context.Context, pipeline interface{}, opts ...*options.ChangeStreamOptions) (mongoifc.ChangeStream, error) { _va := make([]interface{}, len(opts)) @@ -693,6 +1517,43 @@ func (_m *Collection) Watch(ctx context.Context, pipeline interface{}, opts ...* return r0, r1 } +// Collection_Watch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Watch' +type Collection_Watch_Call struct { + *mock.Call +} + +// Watch is a helper method to define mock.On call +// - ctx context.Context +// - pipeline interface{} +// - opts ...*options.ChangeStreamOptions +func (_e *Collection_Expecter) Watch(ctx interface{}, pipeline interface{}, opts ...interface{}) *Collection_Watch_Call { + return &Collection_Watch_Call{Call: _e.mock.On("Watch", + append([]interface{}{ctx, pipeline}, opts...)...)} +} + +func (_c *Collection_Watch_Call) Run(run func(ctx context.Context, pipeline interface{}, opts ...*options.ChangeStreamOptions)) *Collection_Watch_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.ChangeStreamOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.ChangeStreamOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Collection_Watch_Call) Return(_a0 mongoifc.ChangeStream, _a1 error) *Collection_Watch_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Collection_Watch_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.ChangeStreamOptions) (mongoifc.ChangeStream, error)) *Collection_Watch_Call { + _c.Call.Return(run) + return _c +} + // NewCollection creates a new instance of Collection. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewCollection(t interface { diff --git a/mocks/mockery/cursor.go b/mocks/mockery/cursor.go index d559d3f..f816e89 100644 --- a/mocks/mockery/cursor.go +++ b/mocks/mockery/cursor.go @@ -15,6 +15,14 @@ type Cursor struct { mock.Mock } +type Cursor_Expecter struct { + mock *mock.Mock +} + +func (_m *Cursor) EXPECT() *Cursor_Expecter { + return &Cursor_Expecter{mock: &_m.Mock} +} + // All provides a mock function with given fields: ctx, results func (_m *Cursor) All(ctx context.Context, results interface{}) error { ret := _m.Called(ctx, results) @@ -29,6 +37,35 @@ func (_m *Cursor) All(ctx context.Context, results interface{}) error { return r0 } +// Cursor_All_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'All' +type Cursor_All_Call struct { + *mock.Call +} + +// All is a helper method to define mock.On call +// - ctx context.Context +// - results interface{} +func (_e *Cursor_Expecter) All(ctx interface{}, results interface{}) *Cursor_All_Call { + return &Cursor_All_Call{Call: _e.mock.On("All", ctx, results)} +} + +func (_c *Cursor_All_Call) Run(run func(ctx context.Context, results interface{})) *Cursor_All_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(interface{})) + }) + return _c +} + +func (_c *Cursor_All_Call) Return(_a0 error) *Cursor_All_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Cursor_All_Call) RunAndReturn(run func(context.Context, interface{}) error) *Cursor_All_Call { + _c.Call.Return(run) + return _c +} + // Close provides a mock function with given fields: ctx func (_m *Cursor) Close(ctx context.Context) error { ret := _m.Called(ctx) @@ -43,6 +80,34 @@ func (_m *Cursor) Close(ctx context.Context) error { return r0 } +// Cursor_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' +type Cursor_Close_Call struct { + *mock.Call +} + +// Close is a helper method to define mock.On call +// - ctx context.Context +func (_e *Cursor_Expecter) Close(ctx interface{}) *Cursor_Close_Call { + return &Cursor_Close_Call{Call: _e.mock.On("Close", ctx)} +} + +func (_c *Cursor_Close_Call) Run(run func(ctx context.Context)) *Cursor_Close_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Cursor_Close_Call) Return(_a0 error) *Cursor_Close_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Cursor_Close_Call) RunAndReturn(run func(context.Context) error) *Cursor_Close_Call { + _c.Call.Return(run) + return _c +} + // Current provides a mock function with given fields: func (_m *Cursor) Current() bson.Raw { ret := _m.Called() @@ -59,6 +124,33 @@ func (_m *Cursor) Current() bson.Raw { return r0 } +// Cursor_Current_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Current' +type Cursor_Current_Call struct { + *mock.Call +} + +// Current is a helper method to define mock.On call +func (_e *Cursor_Expecter) Current() *Cursor_Current_Call { + return &Cursor_Current_Call{Call: _e.mock.On("Current")} +} + +func (_c *Cursor_Current_Call) Run(run func()) *Cursor_Current_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Cursor_Current_Call) Return(_a0 bson.Raw) *Cursor_Current_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Cursor_Current_Call) RunAndReturn(run func() bson.Raw) *Cursor_Current_Call { + _c.Call.Return(run) + return _c +} + // Decode provides a mock function with given fields: val func (_m *Cursor) Decode(val interface{}) error { ret := _m.Called(val) @@ -73,6 +165,34 @@ func (_m *Cursor) Decode(val interface{}) error { return r0 } +// Cursor_Decode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Decode' +type Cursor_Decode_Call struct { + *mock.Call +} + +// Decode is a helper method to define mock.On call +// - val interface{} +func (_e *Cursor_Expecter) Decode(val interface{}) *Cursor_Decode_Call { + return &Cursor_Decode_Call{Call: _e.mock.On("Decode", val)} +} + +func (_c *Cursor_Decode_Call) Run(run func(val interface{})) *Cursor_Decode_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(interface{})) + }) + return _c +} + +func (_c *Cursor_Decode_Call) Return(_a0 error) *Cursor_Decode_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Cursor_Decode_Call) RunAndReturn(run func(interface{}) error) *Cursor_Decode_Call { + _c.Call.Return(run) + return _c +} + // Err provides a mock function with given fields: func (_m *Cursor) Err() error { ret := _m.Called() @@ -87,6 +207,33 @@ func (_m *Cursor) Err() error { return r0 } +// Cursor_Err_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Err' +type Cursor_Err_Call struct { + *mock.Call +} + +// Err is a helper method to define mock.On call +func (_e *Cursor_Expecter) Err() *Cursor_Err_Call { + return &Cursor_Err_Call{Call: _e.mock.On("Err")} +} + +func (_c *Cursor_Err_Call) Run(run func()) *Cursor_Err_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Cursor_Err_Call) Return(_a0 error) *Cursor_Err_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Cursor_Err_Call) RunAndReturn(run func() error) *Cursor_Err_Call { + _c.Call.Return(run) + return _c +} + // ID provides a mock function with given fields: func (_m *Cursor) ID() int64 { ret := _m.Called() @@ -101,6 +248,33 @@ func (_m *Cursor) ID() int64 { return r0 } +// Cursor_ID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ID' +type Cursor_ID_Call struct { + *mock.Call +} + +// ID is a helper method to define mock.On call +func (_e *Cursor_Expecter) ID() *Cursor_ID_Call { + return &Cursor_ID_Call{Call: _e.mock.On("ID")} +} + +func (_c *Cursor_ID_Call) Run(run func()) *Cursor_ID_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Cursor_ID_Call) Return(_a0 int64) *Cursor_ID_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Cursor_ID_Call) RunAndReturn(run func() int64) *Cursor_ID_Call { + _c.Call.Return(run) + return _c +} + // Next provides a mock function with given fields: ctx func (_m *Cursor) Next(ctx context.Context) bool { ret := _m.Called(ctx) @@ -115,6 +289,34 @@ func (_m *Cursor) Next(ctx context.Context) bool { return r0 } +// Cursor_Next_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Next' +type Cursor_Next_Call struct { + *mock.Call +} + +// Next is a helper method to define mock.On call +// - ctx context.Context +func (_e *Cursor_Expecter) Next(ctx interface{}) *Cursor_Next_Call { + return &Cursor_Next_Call{Call: _e.mock.On("Next", ctx)} +} + +func (_c *Cursor_Next_Call) Run(run func(ctx context.Context)) *Cursor_Next_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Cursor_Next_Call) Return(_a0 bool) *Cursor_Next_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Cursor_Next_Call) RunAndReturn(run func(context.Context) bool) *Cursor_Next_Call { + _c.Call.Return(run) + return _c +} + // RemainingBatchLength provides a mock function with given fields: func (_m *Cursor) RemainingBatchLength() int { ret := _m.Called() @@ -129,11 +331,66 @@ func (_m *Cursor) RemainingBatchLength() int { return r0 } +// Cursor_RemainingBatchLength_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemainingBatchLength' +type Cursor_RemainingBatchLength_Call struct { + *mock.Call +} + +// RemainingBatchLength is a helper method to define mock.On call +func (_e *Cursor_Expecter) RemainingBatchLength() *Cursor_RemainingBatchLength_Call { + return &Cursor_RemainingBatchLength_Call{Call: _e.mock.On("RemainingBatchLength")} +} + +func (_c *Cursor_RemainingBatchLength_Call) Run(run func()) *Cursor_RemainingBatchLength_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Cursor_RemainingBatchLength_Call) Return(_a0 int) *Cursor_RemainingBatchLength_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Cursor_RemainingBatchLength_Call) RunAndReturn(run func() int) *Cursor_RemainingBatchLength_Call { + _c.Call.Return(run) + return _c +} + // SetBatchSize provides a mock function with given fields: batchSize func (_m *Cursor) SetBatchSize(batchSize int32) { _m.Called(batchSize) } +// Cursor_SetBatchSize_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetBatchSize' +type Cursor_SetBatchSize_Call struct { + *mock.Call +} + +// SetBatchSize is a helper method to define mock.On call +// - batchSize int32 +func (_e *Cursor_Expecter) SetBatchSize(batchSize interface{}) *Cursor_SetBatchSize_Call { + return &Cursor_SetBatchSize_Call{Call: _e.mock.On("SetBatchSize", batchSize)} +} + +func (_c *Cursor_SetBatchSize_Call) Run(run func(batchSize int32)) *Cursor_SetBatchSize_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(int32)) + }) + return _c +} + +func (_c *Cursor_SetBatchSize_Call) Return() *Cursor_SetBatchSize_Call { + _c.Call.Return() + return _c +} + +func (_c *Cursor_SetBatchSize_Call) RunAndReturn(run func(int32)) *Cursor_SetBatchSize_Call { + _c.Call.Return(run) + return _c +} + // TryNext provides a mock function with given fields: ctx func (_m *Cursor) TryNext(ctx context.Context) bool { ret := _m.Called(ctx) @@ -148,6 +405,34 @@ func (_m *Cursor) TryNext(ctx context.Context) bool { return r0 } +// Cursor_TryNext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TryNext' +type Cursor_TryNext_Call struct { + *mock.Call +} + +// TryNext is a helper method to define mock.On call +// - ctx context.Context +func (_e *Cursor_Expecter) TryNext(ctx interface{}) *Cursor_TryNext_Call { + return &Cursor_TryNext_Call{Call: _e.mock.On("TryNext", ctx)} +} + +func (_c *Cursor_TryNext_Call) Run(run func(ctx context.Context)) *Cursor_TryNext_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Cursor_TryNext_Call) Return(_a0 bool) *Cursor_TryNext_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Cursor_TryNext_Call) RunAndReturn(run func(context.Context) bool) *Cursor_TryNext_Call { + _c.Call.Return(run) + return _c +} + // NewCursor creates a new instance of Cursor. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewCursor(t interface { diff --git a/mocks/mockery/database.go b/mocks/mockery/database.go index 2715e4a..2f0d994 100644 --- a/mocks/mockery/database.go +++ b/mocks/mockery/database.go @@ -24,6 +24,14 @@ type Database struct { mock.Mock } +type Database_Expecter struct { + mock *mock.Mock +} + +func (_m *Database) EXPECT() *Database_Expecter { + return &Database_Expecter{mock: &_m.Mock} +} + // Aggregate provides a mock function with given fields: ctx, pipeline, opts func (_m *Database) Aggregate(ctx context.Context, pipeline interface{}, opts ...*options.AggregateOptions) (mongoifc.Cursor, error) { _va := make([]interface{}, len(opts)) @@ -57,6 +65,43 @@ func (_m *Database) Aggregate(ctx context.Context, pipeline interface{}, opts .. return r0, r1 } +// Database_Aggregate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Aggregate' +type Database_Aggregate_Call struct { + *mock.Call +} + +// Aggregate is a helper method to define mock.On call +// - ctx context.Context +// - pipeline interface{} +// - opts ...*options.AggregateOptions +func (_e *Database_Expecter) Aggregate(ctx interface{}, pipeline interface{}, opts ...interface{}) *Database_Aggregate_Call { + return &Database_Aggregate_Call{Call: _e.mock.On("Aggregate", + append([]interface{}{ctx, pipeline}, opts...)...)} +} + +func (_c *Database_Aggregate_Call) Run(run func(ctx context.Context, pipeline interface{}, opts ...*options.AggregateOptions)) *Database_Aggregate_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.AggregateOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.AggregateOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Database_Aggregate_Call) Return(_a0 mongoifc.Cursor, _a1 error) *Database_Aggregate_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Database_Aggregate_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.AggregateOptions) (mongoifc.Cursor, error)) *Database_Aggregate_Call { + _c.Call.Return(run) + return _c +} + // Client provides a mock function with given fields: func (_m *Database) Client() mongoifc.Client { ret := _m.Called() @@ -73,6 +118,33 @@ func (_m *Database) Client() mongoifc.Client { return r0 } +// Database_Client_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Client' +type Database_Client_Call struct { + *mock.Call +} + +// Client is a helper method to define mock.On call +func (_e *Database_Expecter) Client() *Database_Client_Call { + return &Database_Client_Call{Call: _e.mock.On("Client")} +} + +func (_c *Database_Client_Call) Run(run func()) *Database_Client_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Database_Client_Call) Return(_a0 mongoifc.Client) *Database_Client_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Database_Client_Call) RunAndReturn(run func() mongoifc.Client) *Database_Client_Call { + _c.Call.Return(run) + return _c +} + // Collection provides a mock function with given fields: name, opts func (_m *Database) Collection(name string, opts ...*options.CollectionOptions) mongoifc.Collection { _va := make([]interface{}, len(opts)) @@ -96,6 +168,42 @@ func (_m *Database) Collection(name string, opts ...*options.CollectionOptions) return r0 } +// Database_Collection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Collection' +type Database_Collection_Call struct { + *mock.Call +} + +// Collection is a helper method to define mock.On call +// - name string +// - opts ...*options.CollectionOptions +func (_e *Database_Expecter) Collection(name interface{}, opts ...interface{}) *Database_Collection_Call { + return &Database_Collection_Call{Call: _e.mock.On("Collection", + append([]interface{}{name}, opts...)...)} +} + +func (_c *Database_Collection_Call) Run(run func(name string, opts ...*options.CollectionOptions)) *Database_Collection_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.CollectionOptions, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(*options.CollectionOptions) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *Database_Collection_Call) Return(_a0 mongoifc.Collection) *Database_Collection_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Database_Collection_Call) RunAndReturn(run func(string, ...*options.CollectionOptions) mongoifc.Collection) *Database_Collection_Call { + _c.Call.Return(run) + return _c +} + // CreateCollection provides a mock function with given fields: ctx, name, opts func (_m *Database) CreateCollection(ctx context.Context, name string, opts ...*options.CreateCollectionOptions) error { _va := make([]interface{}, len(opts)) @@ -117,6 +225,43 @@ func (_m *Database) CreateCollection(ctx context.Context, name string, opts ...* return r0 } +// Database_CreateCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateCollection' +type Database_CreateCollection_Call struct { + *mock.Call +} + +// CreateCollection is a helper method to define mock.On call +// - ctx context.Context +// - name string +// - opts ...*options.CreateCollectionOptions +func (_e *Database_Expecter) CreateCollection(ctx interface{}, name interface{}, opts ...interface{}) *Database_CreateCollection_Call { + return &Database_CreateCollection_Call{Call: _e.mock.On("CreateCollection", + append([]interface{}{ctx, name}, opts...)...)} +} + +func (_c *Database_CreateCollection_Call) Run(run func(ctx context.Context, name string, opts ...*options.CreateCollectionOptions)) *Database_CreateCollection_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.CreateCollectionOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.CreateCollectionOptions) + } + } + run(args[0].(context.Context), args[1].(string), variadicArgs...) + }) + return _c +} + +func (_c *Database_CreateCollection_Call) Return(_a0 error) *Database_CreateCollection_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Database_CreateCollection_Call) RunAndReturn(run func(context.Context, string, ...*options.CreateCollectionOptions) error) *Database_CreateCollection_Call { + _c.Call.Return(run) + return _c +} + // CreateView provides a mock function with given fields: ctx, viewName, viewOn, pipeline, opts func (_m *Database) CreateView(ctx context.Context, viewName string, viewOn string, pipeline interface{}, opts ...*options.CreateViewOptions) error { _va := make([]interface{}, len(opts)) @@ -138,6 +283,45 @@ func (_m *Database) CreateView(ctx context.Context, viewName string, viewOn stri return r0 } +// Database_CreateView_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateView' +type Database_CreateView_Call struct { + *mock.Call +} + +// CreateView is a helper method to define mock.On call +// - ctx context.Context +// - viewName string +// - viewOn string +// - pipeline interface{} +// - opts ...*options.CreateViewOptions +func (_e *Database_Expecter) CreateView(ctx interface{}, viewName interface{}, viewOn interface{}, pipeline interface{}, opts ...interface{}) *Database_CreateView_Call { + return &Database_CreateView_Call{Call: _e.mock.On("CreateView", + append([]interface{}{ctx, viewName, viewOn, pipeline}, opts...)...)} +} + +func (_c *Database_CreateView_Call) Run(run func(ctx context.Context, viewName string, viewOn string, pipeline interface{}, opts ...*options.CreateViewOptions)) *Database_CreateView_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.CreateViewOptions, len(args)-4) + for i, a := range args[4:] { + if a != nil { + variadicArgs[i] = a.(*options.CreateViewOptions) + } + } + run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Database_CreateView_Call) Return(_a0 error) *Database_CreateView_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Database_CreateView_Call) RunAndReturn(run func(context.Context, string, string, interface{}, ...*options.CreateViewOptions) error) *Database_CreateView_Call { + _c.Call.Return(run) + return _c +} + // Drop provides a mock function with given fields: ctx func (_m *Database) Drop(ctx context.Context) error { ret := _m.Called(ctx) @@ -152,6 +336,34 @@ func (_m *Database) Drop(ctx context.Context) error { return r0 } +// Database_Drop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Drop' +type Database_Drop_Call struct { + *mock.Call +} + +// Drop is a helper method to define mock.On call +// - ctx context.Context +func (_e *Database_Expecter) Drop(ctx interface{}) *Database_Drop_Call { + return &Database_Drop_Call{Call: _e.mock.On("Drop", ctx)} +} + +func (_c *Database_Drop_Call) Run(run func(ctx context.Context)) *Database_Drop_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Database_Drop_Call) Return(_a0 error) *Database_Drop_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Database_Drop_Call) RunAndReturn(run func(context.Context) error) *Database_Drop_Call { + _c.Call.Return(run) + return _c +} + // ListCollectionNames provides a mock function with given fields: ctx, filter, opts func (_m *Database) ListCollectionNames(ctx context.Context, filter interface{}, opts ...*options.ListCollectionsOptions) ([]string, error) { _va := make([]interface{}, len(opts)) @@ -185,6 +397,43 @@ func (_m *Database) ListCollectionNames(ctx context.Context, filter interface{}, return r0, r1 } +// Database_ListCollectionNames_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListCollectionNames' +type Database_ListCollectionNames_Call struct { + *mock.Call +} + +// ListCollectionNames is a helper method to define mock.On call +// - ctx context.Context +// - filter interface{} +// - opts ...*options.ListCollectionsOptions +func (_e *Database_Expecter) ListCollectionNames(ctx interface{}, filter interface{}, opts ...interface{}) *Database_ListCollectionNames_Call { + return &Database_ListCollectionNames_Call{Call: _e.mock.On("ListCollectionNames", + append([]interface{}{ctx, filter}, opts...)...)} +} + +func (_c *Database_ListCollectionNames_Call) Run(run func(ctx context.Context, filter interface{}, opts ...*options.ListCollectionsOptions)) *Database_ListCollectionNames_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.ListCollectionsOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.ListCollectionsOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Database_ListCollectionNames_Call) Return(_a0 []string, _a1 error) *Database_ListCollectionNames_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Database_ListCollectionNames_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.ListCollectionsOptions) ([]string, error)) *Database_ListCollectionNames_Call { + _c.Call.Return(run) + return _c +} + // ListCollectionSpecifications provides a mock function with given fields: ctx, filter, opts func (_m *Database) ListCollectionSpecifications(ctx context.Context, filter interface{}, opts ...*options.ListCollectionsOptions) ([]*mongo.CollectionSpecification, error) { _va := make([]interface{}, len(opts)) @@ -218,6 +467,43 @@ func (_m *Database) ListCollectionSpecifications(ctx context.Context, filter int return r0, r1 } +// Database_ListCollectionSpecifications_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListCollectionSpecifications' +type Database_ListCollectionSpecifications_Call struct { + *mock.Call +} + +// ListCollectionSpecifications is a helper method to define mock.On call +// - ctx context.Context +// - filter interface{} +// - opts ...*options.ListCollectionsOptions +func (_e *Database_Expecter) ListCollectionSpecifications(ctx interface{}, filter interface{}, opts ...interface{}) *Database_ListCollectionSpecifications_Call { + return &Database_ListCollectionSpecifications_Call{Call: _e.mock.On("ListCollectionSpecifications", + append([]interface{}{ctx, filter}, opts...)...)} +} + +func (_c *Database_ListCollectionSpecifications_Call) Run(run func(ctx context.Context, filter interface{}, opts ...*options.ListCollectionsOptions)) *Database_ListCollectionSpecifications_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.ListCollectionsOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.ListCollectionsOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Database_ListCollectionSpecifications_Call) Return(_a0 []*mongo.CollectionSpecification, _a1 error) *Database_ListCollectionSpecifications_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Database_ListCollectionSpecifications_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.ListCollectionsOptions) ([]*mongo.CollectionSpecification, error)) *Database_ListCollectionSpecifications_Call { + _c.Call.Return(run) + return _c +} + // ListCollections provides a mock function with given fields: ctx, filter, opts func (_m *Database) ListCollections(ctx context.Context, filter interface{}, opts ...*options.ListCollectionsOptions) (mongoifc.Cursor, error) { _va := make([]interface{}, len(opts)) @@ -251,6 +537,43 @@ func (_m *Database) ListCollections(ctx context.Context, filter interface{}, opt return r0, r1 } +// Database_ListCollections_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListCollections' +type Database_ListCollections_Call struct { + *mock.Call +} + +// ListCollections is a helper method to define mock.On call +// - ctx context.Context +// - filter interface{} +// - opts ...*options.ListCollectionsOptions +func (_e *Database_Expecter) ListCollections(ctx interface{}, filter interface{}, opts ...interface{}) *Database_ListCollections_Call { + return &Database_ListCollections_Call{Call: _e.mock.On("ListCollections", + append([]interface{}{ctx, filter}, opts...)...)} +} + +func (_c *Database_ListCollections_Call) Run(run func(ctx context.Context, filter interface{}, opts ...*options.ListCollectionsOptions)) *Database_ListCollections_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.ListCollectionsOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.ListCollectionsOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Database_ListCollections_Call) Return(_a0 mongoifc.Cursor, _a1 error) *Database_ListCollections_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Database_ListCollections_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.ListCollectionsOptions) (mongoifc.Cursor, error)) *Database_ListCollections_Call { + _c.Call.Return(run) + return _c +} + // Name provides a mock function with given fields: func (_m *Database) Name() string { ret := _m.Called() @@ -265,6 +588,33 @@ func (_m *Database) Name() string { return r0 } +// Database_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' +type Database_Name_Call struct { + *mock.Call +} + +// Name is a helper method to define mock.On call +func (_e *Database_Expecter) Name() *Database_Name_Call { + return &Database_Name_Call{Call: _e.mock.On("Name")} +} + +func (_c *Database_Name_Call) Run(run func()) *Database_Name_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Database_Name_Call) Return(_a0 string) *Database_Name_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Database_Name_Call) RunAndReturn(run func() string) *Database_Name_Call { + _c.Call.Return(run) + return _c +} + // ReadConcern provides a mock function with given fields: func (_m *Database) ReadConcern() *readconcern.ReadConcern { ret := _m.Called() @@ -281,6 +631,33 @@ func (_m *Database) ReadConcern() *readconcern.ReadConcern { return r0 } +// Database_ReadConcern_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadConcern' +type Database_ReadConcern_Call struct { + *mock.Call +} + +// ReadConcern is a helper method to define mock.On call +func (_e *Database_Expecter) ReadConcern() *Database_ReadConcern_Call { + return &Database_ReadConcern_Call{Call: _e.mock.On("ReadConcern")} +} + +func (_c *Database_ReadConcern_Call) Run(run func()) *Database_ReadConcern_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Database_ReadConcern_Call) Return(_a0 *readconcern.ReadConcern) *Database_ReadConcern_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Database_ReadConcern_Call) RunAndReturn(run func() *readconcern.ReadConcern) *Database_ReadConcern_Call { + _c.Call.Return(run) + return _c +} + // ReadPreference provides a mock function with given fields: func (_m *Database) ReadPreference() *readpref.ReadPref { ret := _m.Called() @@ -297,6 +674,33 @@ func (_m *Database) ReadPreference() *readpref.ReadPref { return r0 } +// Database_ReadPreference_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadPreference' +type Database_ReadPreference_Call struct { + *mock.Call +} + +// ReadPreference is a helper method to define mock.On call +func (_e *Database_Expecter) ReadPreference() *Database_ReadPreference_Call { + return &Database_ReadPreference_Call{Call: _e.mock.On("ReadPreference")} +} + +func (_c *Database_ReadPreference_Call) Run(run func()) *Database_ReadPreference_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Database_ReadPreference_Call) Return(_a0 *readpref.ReadPref) *Database_ReadPreference_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Database_ReadPreference_Call) RunAndReturn(run func() *readpref.ReadPref) *Database_ReadPreference_Call { + _c.Call.Return(run) + return _c +} + // RunCommand provides a mock function with given fields: ctx, runCommand, opts func (_m *Database) RunCommand(ctx context.Context, runCommand interface{}, opts ...*options.RunCmdOptions) mongoifc.SingleResult { _va := make([]interface{}, len(opts)) @@ -320,6 +724,43 @@ func (_m *Database) RunCommand(ctx context.Context, runCommand interface{}, opts return r0 } +// Database_RunCommand_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RunCommand' +type Database_RunCommand_Call struct { + *mock.Call +} + +// RunCommand is a helper method to define mock.On call +// - ctx context.Context +// - runCommand interface{} +// - opts ...*options.RunCmdOptions +func (_e *Database_Expecter) RunCommand(ctx interface{}, runCommand interface{}, opts ...interface{}) *Database_RunCommand_Call { + return &Database_RunCommand_Call{Call: _e.mock.On("RunCommand", + append([]interface{}{ctx, runCommand}, opts...)...)} +} + +func (_c *Database_RunCommand_Call) Run(run func(ctx context.Context, runCommand interface{}, opts ...*options.RunCmdOptions)) *Database_RunCommand_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.RunCmdOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.RunCmdOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Database_RunCommand_Call) Return(_a0 mongoifc.SingleResult) *Database_RunCommand_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Database_RunCommand_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.RunCmdOptions) mongoifc.SingleResult) *Database_RunCommand_Call { + _c.Call.Return(run) + return _c +} + // RunCommandCursor provides a mock function with given fields: ctx, runCommand, opts func (_m *Database) RunCommandCursor(ctx context.Context, runCommand interface{}, opts ...*options.RunCmdOptions) (mongoifc.Cursor, error) { _va := make([]interface{}, len(opts)) @@ -353,6 +794,43 @@ func (_m *Database) RunCommandCursor(ctx context.Context, runCommand interface{} return r0, r1 } +// Database_RunCommandCursor_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RunCommandCursor' +type Database_RunCommandCursor_Call struct { + *mock.Call +} + +// RunCommandCursor is a helper method to define mock.On call +// - ctx context.Context +// - runCommand interface{} +// - opts ...*options.RunCmdOptions +func (_e *Database_Expecter) RunCommandCursor(ctx interface{}, runCommand interface{}, opts ...interface{}) *Database_RunCommandCursor_Call { + return &Database_RunCommandCursor_Call{Call: _e.mock.On("RunCommandCursor", + append([]interface{}{ctx, runCommand}, opts...)...)} +} + +func (_c *Database_RunCommandCursor_Call) Run(run func(ctx context.Context, runCommand interface{}, opts ...*options.RunCmdOptions)) *Database_RunCommandCursor_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.RunCmdOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.RunCmdOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Database_RunCommandCursor_Call) Return(_a0 mongoifc.Cursor, _a1 error) *Database_RunCommandCursor_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Database_RunCommandCursor_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.RunCmdOptions) (mongoifc.Cursor, error)) *Database_RunCommandCursor_Call { + _c.Call.Return(run) + return _c +} + // Watch provides a mock function with given fields: ctx, pipeline, opts func (_m *Database) Watch(ctx context.Context, pipeline interface{}, opts ...*options.ChangeStreamOptions) (mongoifc.ChangeStream, error) { _va := make([]interface{}, len(opts)) @@ -386,6 +864,43 @@ func (_m *Database) Watch(ctx context.Context, pipeline interface{}, opts ...*op return r0, r1 } +// Database_Watch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Watch' +type Database_Watch_Call struct { + *mock.Call +} + +// Watch is a helper method to define mock.On call +// - ctx context.Context +// - pipeline interface{} +// - opts ...*options.ChangeStreamOptions +func (_e *Database_Expecter) Watch(ctx interface{}, pipeline interface{}, opts ...interface{}) *Database_Watch_Call { + return &Database_Watch_Call{Call: _e.mock.On("Watch", + append([]interface{}{ctx, pipeline}, opts...)...)} +} + +func (_c *Database_Watch_Call) Run(run func(ctx context.Context, pipeline interface{}, opts ...*options.ChangeStreamOptions)) *Database_Watch_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.ChangeStreamOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.ChangeStreamOptions) + } + } + run(args[0].(context.Context), args[1].(interface{}), variadicArgs...) + }) + return _c +} + +func (_c *Database_Watch_Call) Return(_a0 mongoifc.ChangeStream, _a1 error) *Database_Watch_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Database_Watch_Call) RunAndReturn(run func(context.Context, interface{}, ...*options.ChangeStreamOptions) (mongoifc.ChangeStream, error)) *Database_Watch_Call { + _c.Call.Return(run) + return _c +} + // WriteConcern provides a mock function with given fields: func (_m *Database) WriteConcern() *writeconcern.WriteConcern { ret := _m.Called() @@ -402,6 +917,33 @@ func (_m *Database) WriteConcern() *writeconcern.WriteConcern { return r0 } +// Database_WriteConcern_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteConcern' +type Database_WriteConcern_Call struct { + *mock.Call +} + +// WriteConcern is a helper method to define mock.On call +func (_e *Database_Expecter) WriteConcern() *Database_WriteConcern_Call { + return &Database_WriteConcern_Call{Call: _e.mock.On("WriteConcern")} +} + +func (_c *Database_WriteConcern_Call) Run(run func()) *Database_WriteConcern_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Database_WriteConcern_Call) Return(_a0 *writeconcern.WriteConcern) *Database_WriteConcern_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Database_WriteConcern_Call) RunAndReturn(run func() *writeconcern.WriteConcern) *Database_WriteConcern_Call { + _c.Call.Return(run) + return _c +} + // NewDatabase creates a new instance of Database. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewDatabase(t interface { diff --git a/mocks/mockery/index_view.go b/mocks/mockery/index_view.go index feed901..276b893 100644 --- a/mocks/mockery/index_view.go +++ b/mocks/mockery/index_view.go @@ -21,6 +21,14 @@ type IndexView struct { mock.Mock } +type IndexView_Expecter struct { + mock *mock.Mock +} + +func (_m *IndexView) EXPECT() *IndexView_Expecter { + return &IndexView_Expecter{mock: &_m.Mock} +} + // CreateMany provides a mock function with given fields: ctx, models, opts func (_m *IndexView) CreateMany(ctx context.Context, models []mongo.IndexModel, opts ...*options.CreateIndexesOptions) ([]string, error) { _va := make([]interface{}, len(opts)) @@ -54,6 +62,43 @@ func (_m *IndexView) CreateMany(ctx context.Context, models []mongo.IndexModel, return r0, r1 } +// IndexView_CreateMany_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateMany' +type IndexView_CreateMany_Call struct { + *mock.Call +} + +// CreateMany is a helper method to define mock.On call +// - ctx context.Context +// - models []mongo.IndexModel +// - opts ...*options.CreateIndexesOptions +func (_e *IndexView_Expecter) CreateMany(ctx interface{}, models interface{}, opts ...interface{}) *IndexView_CreateMany_Call { + return &IndexView_CreateMany_Call{Call: _e.mock.On("CreateMany", + append([]interface{}{ctx, models}, opts...)...)} +} + +func (_c *IndexView_CreateMany_Call) Run(run func(ctx context.Context, models []mongo.IndexModel, opts ...*options.CreateIndexesOptions)) *IndexView_CreateMany_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.CreateIndexesOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.CreateIndexesOptions) + } + } + run(args[0].(context.Context), args[1].([]mongo.IndexModel), variadicArgs...) + }) + return _c +} + +func (_c *IndexView_CreateMany_Call) Return(_a0 []string, _a1 error) *IndexView_CreateMany_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IndexView_CreateMany_Call) RunAndReturn(run func(context.Context, []mongo.IndexModel, ...*options.CreateIndexesOptions) ([]string, error)) *IndexView_CreateMany_Call { + _c.Call.Return(run) + return _c +} + // CreateOne provides a mock function with given fields: ctx, model, opts func (_m *IndexView) CreateOne(ctx context.Context, model mongo.IndexModel, opts ...*options.CreateIndexesOptions) (string, error) { _va := make([]interface{}, len(opts)) @@ -85,6 +130,43 @@ func (_m *IndexView) CreateOne(ctx context.Context, model mongo.IndexModel, opts return r0, r1 } +// IndexView_CreateOne_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateOne' +type IndexView_CreateOne_Call struct { + *mock.Call +} + +// CreateOne is a helper method to define mock.On call +// - ctx context.Context +// - model mongo.IndexModel +// - opts ...*options.CreateIndexesOptions +func (_e *IndexView_Expecter) CreateOne(ctx interface{}, model interface{}, opts ...interface{}) *IndexView_CreateOne_Call { + return &IndexView_CreateOne_Call{Call: _e.mock.On("CreateOne", + append([]interface{}{ctx, model}, opts...)...)} +} + +func (_c *IndexView_CreateOne_Call) Run(run func(ctx context.Context, model mongo.IndexModel, opts ...*options.CreateIndexesOptions)) *IndexView_CreateOne_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.CreateIndexesOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.CreateIndexesOptions) + } + } + run(args[0].(context.Context), args[1].(mongo.IndexModel), variadicArgs...) + }) + return _c +} + +func (_c *IndexView_CreateOne_Call) Return(_a0 string, _a1 error) *IndexView_CreateOne_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IndexView_CreateOne_Call) RunAndReturn(run func(context.Context, mongo.IndexModel, ...*options.CreateIndexesOptions) (string, error)) *IndexView_CreateOne_Call { + _c.Call.Return(run) + return _c +} + // DropAll provides a mock function with given fields: ctx, opts func (_m *IndexView) DropAll(ctx context.Context, opts ...*options.DropIndexesOptions) (bson.Raw, error) { _va := make([]interface{}, len(opts)) @@ -118,6 +200,42 @@ func (_m *IndexView) DropAll(ctx context.Context, opts ...*options.DropIndexesOp return r0, r1 } +// IndexView_DropAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropAll' +type IndexView_DropAll_Call struct { + *mock.Call +} + +// DropAll is a helper method to define mock.On call +// - ctx context.Context +// - opts ...*options.DropIndexesOptions +func (_e *IndexView_Expecter) DropAll(ctx interface{}, opts ...interface{}) *IndexView_DropAll_Call { + return &IndexView_DropAll_Call{Call: _e.mock.On("DropAll", + append([]interface{}{ctx}, opts...)...)} +} + +func (_c *IndexView_DropAll_Call) Run(run func(ctx context.Context, opts ...*options.DropIndexesOptions)) *IndexView_DropAll_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.DropIndexesOptions, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(*options.DropIndexesOptions) + } + } + run(args[0].(context.Context), variadicArgs...) + }) + return _c +} + +func (_c *IndexView_DropAll_Call) Return(_a0 bson.Raw, _a1 error) *IndexView_DropAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IndexView_DropAll_Call) RunAndReturn(run func(context.Context, ...*options.DropIndexesOptions) (bson.Raw, error)) *IndexView_DropAll_Call { + _c.Call.Return(run) + return _c +} + // DropOne provides a mock function with given fields: ctx, name, opts func (_m *IndexView) DropOne(ctx context.Context, name string, opts ...*options.DropIndexesOptions) (bson.Raw, error) { _va := make([]interface{}, len(opts)) @@ -151,6 +269,43 @@ func (_m *IndexView) DropOne(ctx context.Context, name string, opts ...*options. return r0, r1 } +// IndexView_DropOne_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropOne' +type IndexView_DropOne_Call struct { + *mock.Call +} + +// DropOne is a helper method to define mock.On call +// - ctx context.Context +// - name string +// - opts ...*options.DropIndexesOptions +func (_e *IndexView_Expecter) DropOne(ctx interface{}, name interface{}, opts ...interface{}) *IndexView_DropOne_Call { + return &IndexView_DropOne_Call{Call: _e.mock.On("DropOne", + append([]interface{}{ctx, name}, opts...)...)} +} + +func (_c *IndexView_DropOne_Call) Run(run func(ctx context.Context, name string, opts ...*options.DropIndexesOptions)) *IndexView_DropOne_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.DropIndexesOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.DropIndexesOptions) + } + } + run(args[0].(context.Context), args[1].(string), variadicArgs...) + }) + return _c +} + +func (_c *IndexView_DropOne_Call) Return(_a0 bson.Raw, _a1 error) *IndexView_DropOne_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IndexView_DropOne_Call) RunAndReturn(run func(context.Context, string, ...*options.DropIndexesOptions) (bson.Raw, error)) *IndexView_DropOne_Call { + _c.Call.Return(run) + return _c +} + // List provides a mock function with given fields: ctx, opts func (_m *IndexView) List(ctx context.Context, opts ...*options.ListIndexesOptions) (mongoifc.Cursor, error) { _va := make([]interface{}, len(opts)) @@ -184,6 +339,42 @@ func (_m *IndexView) List(ctx context.Context, opts ...*options.ListIndexesOptio return r0, r1 } +// IndexView_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type IndexView_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - ctx context.Context +// - opts ...*options.ListIndexesOptions +func (_e *IndexView_Expecter) List(ctx interface{}, opts ...interface{}) *IndexView_List_Call { + return &IndexView_List_Call{Call: _e.mock.On("List", + append([]interface{}{ctx}, opts...)...)} +} + +func (_c *IndexView_List_Call) Run(run func(ctx context.Context, opts ...*options.ListIndexesOptions)) *IndexView_List_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.ListIndexesOptions, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(*options.ListIndexesOptions) + } + } + run(args[0].(context.Context), variadicArgs...) + }) + return _c +} + +func (_c *IndexView_List_Call) Return(_a0 mongoifc.Cursor, _a1 error) *IndexView_List_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IndexView_List_Call) RunAndReturn(run func(context.Context, ...*options.ListIndexesOptions) (mongoifc.Cursor, error)) *IndexView_List_Call { + _c.Call.Return(run) + return _c +} + // ListSpecifications provides a mock function with given fields: ctx, opts func (_m *IndexView) ListSpecifications(ctx context.Context, opts ...*options.ListIndexesOptions) ([]*mongo.IndexSpecification, error) { _va := make([]interface{}, len(opts)) @@ -217,6 +408,42 @@ func (_m *IndexView) ListSpecifications(ctx context.Context, opts ...*options.Li return r0, r1 } +// IndexView_ListSpecifications_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListSpecifications' +type IndexView_ListSpecifications_Call struct { + *mock.Call +} + +// ListSpecifications is a helper method to define mock.On call +// - ctx context.Context +// - opts ...*options.ListIndexesOptions +func (_e *IndexView_Expecter) ListSpecifications(ctx interface{}, opts ...interface{}) *IndexView_ListSpecifications_Call { + return &IndexView_ListSpecifications_Call{Call: _e.mock.On("ListSpecifications", + append([]interface{}{ctx}, opts...)...)} +} + +func (_c *IndexView_ListSpecifications_Call) Run(run func(ctx context.Context, opts ...*options.ListIndexesOptions)) *IndexView_ListSpecifications_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.ListIndexesOptions, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(*options.ListIndexesOptions) + } + } + run(args[0].(context.Context), variadicArgs...) + }) + return _c +} + +func (_c *IndexView_ListSpecifications_Call) Return(_a0 []*mongo.IndexSpecification, _a1 error) *IndexView_ListSpecifications_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *IndexView_ListSpecifications_Call) RunAndReturn(run func(context.Context, ...*options.ListIndexesOptions) ([]*mongo.IndexSpecification, error)) *IndexView_ListSpecifications_Call { + _c.Call.Return(run) + return _c +} + // NewIndexView creates a new instance of IndexView. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewIndexView(t interface { diff --git a/mocks/mockery/session.go b/mocks/mockery/session.go index d519ee0..f3af85d 100644 --- a/mocks/mockery/session.go +++ b/mocks/mockery/session.go @@ -21,6 +21,14 @@ type Session struct { mock.Mock } +type Session_Expecter struct { + mock *mock.Mock +} + +func (_m *Session) EXPECT() *Session_Expecter { + return &Session_Expecter{mock: &_m.Mock} +} + // AbortTransaction provides a mock function with given fields: ctx func (_m *Session) AbortTransaction(ctx context.Context) error { ret := _m.Called(ctx) @@ -35,6 +43,34 @@ func (_m *Session) AbortTransaction(ctx context.Context) error { return r0 } +// Session_AbortTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AbortTransaction' +type Session_AbortTransaction_Call struct { + *mock.Call +} + +// AbortTransaction is a helper method to define mock.On call +// - ctx context.Context +func (_e *Session_Expecter) AbortTransaction(ctx interface{}) *Session_AbortTransaction_Call { + return &Session_AbortTransaction_Call{Call: _e.mock.On("AbortTransaction", ctx)} +} + +func (_c *Session_AbortTransaction_Call) Run(run func(ctx context.Context)) *Session_AbortTransaction_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Session_AbortTransaction_Call) Return(_a0 error) *Session_AbortTransaction_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Session_AbortTransaction_Call) RunAndReturn(run func(context.Context) error) *Session_AbortTransaction_Call { + _c.Call.Return(run) + return _c +} + // AdvanceClusterTime provides a mock function with given fields: _a0 func (_m *Session) AdvanceClusterTime(_a0 bson.Raw) error { ret := _m.Called(_a0) @@ -49,6 +85,34 @@ func (_m *Session) AdvanceClusterTime(_a0 bson.Raw) error { return r0 } +// Session_AdvanceClusterTime_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AdvanceClusterTime' +type Session_AdvanceClusterTime_Call struct { + *mock.Call +} + +// AdvanceClusterTime is a helper method to define mock.On call +// - _a0 bson.Raw +func (_e *Session_Expecter) AdvanceClusterTime(_a0 interface{}) *Session_AdvanceClusterTime_Call { + return &Session_AdvanceClusterTime_Call{Call: _e.mock.On("AdvanceClusterTime", _a0)} +} + +func (_c *Session_AdvanceClusterTime_Call) Run(run func(_a0 bson.Raw)) *Session_AdvanceClusterTime_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(bson.Raw)) + }) + return _c +} + +func (_c *Session_AdvanceClusterTime_Call) Return(_a0 error) *Session_AdvanceClusterTime_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Session_AdvanceClusterTime_Call) RunAndReturn(run func(bson.Raw) error) *Session_AdvanceClusterTime_Call { + _c.Call.Return(run) + return _c +} + // AdvanceOperationTime provides a mock function with given fields: _a0 func (_m *Session) AdvanceOperationTime(_a0 *primitive.Timestamp) error { ret := _m.Called(_a0) @@ -63,6 +127,34 @@ func (_m *Session) AdvanceOperationTime(_a0 *primitive.Timestamp) error { return r0 } +// Session_AdvanceOperationTime_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AdvanceOperationTime' +type Session_AdvanceOperationTime_Call struct { + *mock.Call +} + +// AdvanceOperationTime is a helper method to define mock.On call +// - _a0 *primitive.Timestamp +func (_e *Session_Expecter) AdvanceOperationTime(_a0 interface{}) *Session_AdvanceOperationTime_Call { + return &Session_AdvanceOperationTime_Call{Call: _e.mock.On("AdvanceOperationTime", _a0)} +} + +func (_c *Session_AdvanceOperationTime_Call) Run(run func(_a0 *primitive.Timestamp)) *Session_AdvanceOperationTime_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*primitive.Timestamp)) + }) + return _c +} + +func (_c *Session_AdvanceOperationTime_Call) Return(_a0 error) *Session_AdvanceOperationTime_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Session_AdvanceOperationTime_Call) RunAndReturn(run func(*primitive.Timestamp) error) *Session_AdvanceOperationTime_Call { + _c.Call.Return(run) + return _c +} + // Client provides a mock function with given fields: func (_m *Session) Client() mongoifc.Client { ret := _m.Called() @@ -79,6 +171,33 @@ func (_m *Session) Client() mongoifc.Client { return r0 } +// Session_Client_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Client' +type Session_Client_Call struct { + *mock.Call +} + +// Client is a helper method to define mock.On call +func (_e *Session_Expecter) Client() *Session_Client_Call { + return &Session_Client_Call{Call: _e.mock.On("Client")} +} + +func (_c *Session_Client_Call) Run(run func()) *Session_Client_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Session_Client_Call) Return(_a0 mongoifc.Client) *Session_Client_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Session_Client_Call) RunAndReturn(run func() mongoifc.Client) *Session_Client_Call { + _c.Call.Return(run) + return _c +} + // ClusterTime provides a mock function with given fields: func (_m *Session) ClusterTime() bson.Raw { ret := _m.Called() @@ -95,6 +214,33 @@ func (_m *Session) ClusterTime() bson.Raw { return r0 } +// Session_ClusterTime_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ClusterTime' +type Session_ClusterTime_Call struct { + *mock.Call +} + +// ClusterTime is a helper method to define mock.On call +func (_e *Session_Expecter) ClusterTime() *Session_ClusterTime_Call { + return &Session_ClusterTime_Call{Call: _e.mock.On("ClusterTime")} +} + +func (_c *Session_ClusterTime_Call) Run(run func()) *Session_ClusterTime_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Session_ClusterTime_Call) Return(_a0 bson.Raw) *Session_ClusterTime_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Session_ClusterTime_Call) RunAndReturn(run func() bson.Raw) *Session_ClusterTime_Call { + _c.Call.Return(run) + return _c +} + // CommitTransaction provides a mock function with given fields: ctx func (_m *Session) CommitTransaction(ctx context.Context) error { ret := _m.Called(ctx) @@ -109,11 +255,67 @@ func (_m *Session) CommitTransaction(ctx context.Context) error { return r0 } +// Session_CommitTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CommitTransaction' +type Session_CommitTransaction_Call struct { + *mock.Call +} + +// CommitTransaction is a helper method to define mock.On call +// - ctx context.Context +func (_e *Session_Expecter) CommitTransaction(ctx interface{}) *Session_CommitTransaction_Call { + return &Session_CommitTransaction_Call{Call: _e.mock.On("CommitTransaction", ctx)} +} + +func (_c *Session_CommitTransaction_Call) Run(run func(ctx context.Context)) *Session_CommitTransaction_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Session_CommitTransaction_Call) Return(_a0 error) *Session_CommitTransaction_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Session_CommitTransaction_Call) RunAndReturn(run func(context.Context) error) *Session_CommitTransaction_Call { + _c.Call.Return(run) + return _c +} + // EndSession provides a mock function with given fields: ctx func (_m *Session) EndSession(ctx context.Context) { _m.Called(ctx) } +// Session_EndSession_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EndSession' +type Session_EndSession_Call struct { + *mock.Call +} + +// EndSession is a helper method to define mock.On call +// - ctx context.Context +func (_e *Session_Expecter) EndSession(ctx interface{}) *Session_EndSession_Call { + return &Session_EndSession_Call{Call: _e.mock.On("EndSession", ctx)} +} + +func (_c *Session_EndSession_Call) Run(run func(ctx context.Context)) *Session_EndSession_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *Session_EndSession_Call) Return() *Session_EndSession_Call { + _c.Call.Return() + return _c +} + +func (_c *Session_EndSession_Call) RunAndReturn(run func(context.Context)) *Session_EndSession_Call { + _c.Call.Return(run) + return _c +} + // ID provides a mock function with given fields: func (_m *Session) ID() bson.Raw { ret := _m.Called() @@ -130,6 +332,33 @@ func (_m *Session) ID() bson.Raw { return r0 } +// Session_ID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ID' +type Session_ID_Call struct { + *mock.Call +} + +// ID is a helper method to define mock.On call +func (_e *Session_Expecter) ID() *Session_ID_Call { + return &Session_ID_Call{Call: _e.mock.On("ID")} +} + +func (_c *Session_ID_Call) Run(run func()) *Session_ID_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Session_ID_Call) Return(_a0 bson.Raw) *Session_ID_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Session_ID_Call) RunAndReturn(run func() bson.Raw) *Session_ID_Call { + _c.Call.Return(run) + return _c +} + // OperationTime provides a mock function with given fields: func (_m *Session) OperationTime() *primitive.Timestamp { ret := _m.Called() @@ -146,6 +375,33 @@ func (_m *Session) OperationTime() *primitive.Timestamp { return r0 } +// Session_OperationTime_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OperationTime' +type Session_OperationTime_Call struct { + *mock.Call +} + +// OperationTime is a helper method to define mock.On call +func (_e *Session_Expecter) OperationTime() *Session_OperationTime_Call { + return &Session_OperationTime_Call{Call: _e.mock.On("OperationTime")} +} + +func (_c *Session_OperationTime_Call) Run(run func()) *Session_OperationTime_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Session_OperationTime_Call) Return(_a0 *primitive.Timestamp) *Session_OperationTime_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Session_OperationTime_Call) RunAndReturn(run func() *primitive.Timestamp) *Session_OperationTime_Call { + _c.Call.Return(run) + return _c +} + // StartTransaction provides a mock function with given fields: opts func (_m *Session) StartTransaction(opts ...*options.TransactionOptions) error { _va := make([]interface{}, len(opts)) @@ -166,6 +422,41 @@ func (_m *Session) StartTransaction(opts ...*options.TransactionOptions) error { return r0 } +// Session_StartTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartTransaction' +type Session_StartTransaction_Call struct { + *mock.Call +} + +// StartTransaction is a helper method to define mock.On call +// - opts ...*options.TransactionOptions +func (_e *Session_Expecter) StartTransaction(opts ...interface{}) *Session_StartTransaction_Call { + return &Session_StartTransaction_Call{Call: _e.mock.On("StartTransaction", + append([]interface{}{}, opts...)...)} +} + +func (_c *Session_StartTransaction_Call) Run(run func(opts ...*options.TransactionOptions)) *Session_StartTransaction_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.TransactionOptions, len(args)-0) + for i, a := range args[0:] { + if a != nil { + variadicArgs[i] = a.(*options.TransactionOptions) + } + } + run(variadicArgs...) + }) + return _c +} + +func (_c *Session_StartTransaction_Call) Return(_a0 error) *Session_StartTransaction_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Session_StartTransaction_Call) RunAndReturn(run func(...*options.TransactionOptions) error) *Session_StartTransaction_Call { + _c.Call.Return(run) + return _c +} + // WithTransaction provides a mock function with given fields: ctx, fn, opts func (_m *Session) WithTransaction(ctx context.Context, fn func(mongoifc.SessionContext) (interface{}, error), opts ...*options.TransactionOptions) (interface{}, error) { _va := make([]interface{}, len(opts)) @@ -199,6 +490,43 @@ func (_m *Session) WithTransaction(ctx context.Context, fn func(mongoifc.Session return r0, r1 } +// Session_WithTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithTransaction' +type Session_WithTransaction_Call struct { + *mock.Call +} + +// WithTransaction is a helper method to define mock.On call +// - ctx context.Context +// - fn func(mongoifc.SessionContext)(interface{} , error) +// - opts ...*options.TransactionOptions +func (_e *Session_Expecter) WithTransaction(ctx interface{}, fn interface{}, opts ...interface{}) *Session_WithTransaction_Call { + return &Session_WithTransaction_Call{Call: _e.mock.On("WithTransaction", + append([]interface{}{ctx, fn}, opts...)...)} +} + +func (_c *Session_WithTransaction_Call) Run(run func(ctx context.Context, fn func(mongoifc.SessionContext) (interface{}, error), opts ...*options.TransactionOptions)) *Session_WithTransaction_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.TransactionOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.TransactionOptions) + } + } + run(args[0].(context.Context), args[1].(func(mongoifc.SessionContext) (interface{}, error)), variadicArgs...) + }) + return _c +} + +func (_c *Session_WithTransaction_Call) Return(_a0 interface{}, _a1 error) *Session_WithTransaction_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Session_WithTransaction_Call) RunAndReturn(run func(context.Context, func(mongoifc.SessionContext) (interface{}, error), ...*options.TransactionOptions) (interface{}, error)) *Session_WithTransaction_Call { + _c.Call.Return(run) + return _c +} + // NewSession creates a new instance of Session. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewSession(t interface { diff --git a/mocks/mockery/session_context.go b/mocks/mockery/session_context.go index b0064fa..d208d96 100644 --- a/mocks/mockery/session_context.go +++ b/mocks/mockery/session_context.go @@ -23,6 +23,14 @@ type SessionContext struct { mock.Mock } +type SessionContext_Expecter struct { + mock *mock.Mock +} + +func (_m *SessionContext) EXPECT() *SessionContext_Expecter { + return &SessionContext_Expecter{mock: &_m.Mock} +} + // AbortTransaction provides a mock function with given fields: ctx func (_m *SessionContext) AbortTransaction(ctx context.Context) error { ret := _m.Called(ctx) @@ -37,6 +45,34 @@ func (_m *SessionContext) AbortTransaction(ctx context.Context) error { return r0 } +// SessionContext_AbortTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AbortTransaction' +type SessionContext_AbortTransaction_Call struct { + *mock.Call +} + +// AbortTransaction is a helper method to define mock.On call +// - ctx context.Context +func (_e *SessionContext_Expecter) AbortTransaction(ctx interface{}) *SessionContext_AbortTransaction_Call { + return &SessionContext_AbortTransaction_Call{Call: _e.mock.On("AbortTransaction", ctx)} +} + +func (_c *SessionContext_AbortTransaction_Call) Run(run func(ctx context.Context)) *SessionContext_AbortTransaction_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *SessionContext_AbortTransaction_Call) Return(_a0 error) *SessionContext_AbortTransaction_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SessionContext_AbortTransaction_Call) RunAndReturn(run func(context.Context) error) *SessionContext_AbortTransaction_Call { + _c.Call.Return(run) + return _c +} + // AdvanceClusterTime provides a mock function with given fields: _a0 func (_m *SessionContext) AdvanceClusterTime(_a0 bson.Raw) error { ret := _m.Called(_a0) @@ -51,6 +87,34 @@ func (_m *SessionContext) AdvanceClusterTime(_a0 bson.Raw) error { return r0 } +// SessionContext_AdvanceClusterTime_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AdvanceClusterTime' +type SessionContext_AdvanceClusterTime_Call struct { + *mock.Call +} + +// AdvanceClusterTime is a helper method to define mock.On call +// - _a0 bson.Raw +func (_e *SessionContext_Expecter) AdvanceClusterTime(_a0 interface{}) *SessionContext_AdvanceClusterTime_Call { + return &SessionContext_AdvanceClusterTime_Call{Call: _e.mock.On("AdvanceClusterTime", _a0)} +} + +func (_c *SessionContext_AdvanceClusterTime_Call) Run(run func(_a0 bson.Raw)) *SessionContext_AdvanceClusterTime_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(bson.Raw)) + }) + return _c +} + +func (_c *SessionContext_AdvanceClusterTime_Call) Return(_a0 error) *SessionContext_AdvanceClusterTime_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SessionContext_AdvanceClusterTime_Call) RunAndReturn(run func(bson.Raw) error) *SessionContext_AdvanceClusterTime_Call { + _c.Call.Return(run) + return _c +} + // AdvanceOperationTime provides a mock function with given fields: _a0 func (_m *SessionContext) AdvanceOperationTime(_a0 *primitive.Timestamp) error { ret := _m.Called(_a0) @@ -65,6 +129,34 @@ func (_m *SessionContext) AdvanceOperationTime(_a0 *primitive.Timestamp) error { return r0 } +// SessionContext_AdvanceOperationTime_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AdvanceOperationTime' +type SessionContext_AdvanceOperationTime_Call struct { + *mock.Call +} + +// AdvanceOperationTime is a helper method to define mock.On call +// - _a0 *primitive.Timestamp +func (_e *SessionContext_Expecter) AdvanceOperationTime(_a0 interface{}) *SessionContext_AdvanceOperationTime_Call { + return &SessionContext_AdvanceOperationTime_Call{Call: _e.mock.On("AdvanceOperationTime", _a0)} +} + +func (_c *SessionContext_AdvanceOperationTime_Call) Run(run func(_a0 *primitive.Timestamp)) *SessionContext_AdvanceOperationTime_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*primitive.Timestamp)) + }) + return _c +} + +func (_c *SessionContext_AdvanceOperationTime_Call) Return(_a0 error) *SessionContext_AdvanceOperationTime_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SessionContext_AdvanceOperationTime_Call) RunAndReturn(run func(*primitive.Timestamp) error) *SessionContext_AdvanceOperationTime_Call { + _c.Call.Return(run) + return _c +} + // Client provides a mock function with given fields: func (_m *SessionContext) Client() mongoifc.Client { ret := _m.Called() @@ -81,6 +173,33 @@ func (_m *SessionContext) Client() mongoifc.Client { return r0 } +// SessionContext_Client_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Client' +type SessionContext_Client_Call struct { + *mock.Call +} + +// Client is a helper method to define mock.On call +func (_e *SessionContext_Expecter) Client() *SessionContext_Client_Call { + return &SessionContext_Client_Call{Call: _e.mock.On("Client")} +} + +func (_c *SessionContext_Client_Call) Run(run func()) *SessionContext_Client_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SessionContext_Client_Call) Return(_a0 mongoifc.Client) *SessionContext_Client_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SessionContext_Client_Call) RunAndReturn(run func() mongoifc.Client) *SessionContext_Client_Call { + _c.Call.Return(run) + return _c +} + // ClusterTime provides a mock function with given fields: func (_m *SessionContext) ClusterTime() bson.Raw { ret := _m.Called() @@ -97,6 +216,33 @@ func (_m *SessionContext) ClusterTime() bson.Raw { return r0 } +// SessionContext_ClusterTime_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ClusterTime' +type SessionContext_ClusterTime_Call struct { + *mock.Call +} + +// ClusterTime is a helper method to define mock.On call +func (_e *SessionContext_Expecter) ClusterTime() *SessionContext_ClusterTime_Call { + return &SessionContext_ClusterTime_Call{Call: _e.mock.On("ClusterTime")} +} + +func (_c *SessionContext_ClusterTime_Call) Run(run func()) *SessionContext_ClusterTime_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SessionContext_ClusterTime_Call) Return(_a0 bson.Raw) *SessionContext_ClusterTime_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SessionContext_ClusterTime_Call) RunAndReturn(run func() bson.Raw) *SessionContext_ClusterTime_Call { + _c.Call.Return(run) + return _c +} + // CommitTransaction provides a mock function with given fields: ctx func (_m *SessionContext) CommitTransaction(ctx context.Context) error { ret := _m.Called(ctx) @@ -111,6 +257,34 @@ func (_m *SessionContext) CommitTransaction(ctx context.Context) error { return r0 } +// SessionContext_CommitTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CommitTransaction' +type SessionContext_CommitTransaction_Call struct { + *mock.Call +} + +// CommitTransaction is a helper method to define mock.On call +// - ctx context.Context +func (_e *SessionContext_Expecter) CommitTransaction(ctx interface{}) *SessionContext_CommitTransaction_Call { + return &SessionContext_CommitTransaction_Call{Call: _e.mock.On("CommitTransaction", ctx)} +} + +func (_c *SessionContext_CommitTransaction_Call) Run(run func(ctx context.Context)) *SessionContext_CommitTransaction_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *SessionContext_CommitTransaction_Call) Return(_a0 error) *SessionContext_CommitTransaction_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SessionContext_CommitTransaction_Call) RunAndReturn(run func(context.Context) error) *SessionContext_CommitTransaction_Call { + _c.Call.Return(run) + return _c +} + // Deadline provides a mock function with given fields: func (_m *SessionContext) Deadline() (time.Time, bool) { ret := _m.Called() @@ -135,6 +309,33 @@ func (_m *SessionContext) Deadline() (time.Time, bool) { return r0, r1 } +// SessionContext_Deadline_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Deadline' +type SessionContext_Deadline_Call struct { + *mock.Call +} + +// Deadline is a helper method to define mock.On call +func (_e *SessionContext_Expecter) Deadline() *SessionContext_Deadline_Call { + return &SessionContext_Deadline_Call{Call: _e.mock.On("Deadline")} +} + +func (_c *SessionContext_Deadline_Call) Run(run func()) *SessionContext_Deadline_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SessionContext_Deadline_Call) Return(deadline time.Time, ok bool) *SessionContext_Deadline_Call { + _c.Call.Return(deadline, ok) + return _c +} + +func (_c *SessionContext_Deadline_Call) RunAndReturn(run func() (time.Time, bool)) *SessionContext_Deadline_Call { + _c.Call.Return(run) + return _c +} + // Done provides a mock function with given fields: func (_m *SessionContext) Done() <-chan struct{} { ret := _m.Called() @@ -151,11 +352,66 @@ func (_m *SessionContext) Done() <-chan struct{} { return r0 } +// SessionContext_Done_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Done' +type SessionContext_Done_Call struct { + *mock.Call +} + +// Done is a helper method to define mock.On call +func (_e *SessionContext_Expecter) Done() *SessionContext_Done_Call { + return &SessionContext_Done_Call{Call: _e.mock.On("Done")} +} + +func (_c *SessionContext_Done_Call) Run(run func()) *SessionContext_Done_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SessionContext_Done_Call) Return(_a0 <-chan struct{}) *SessionContext_Done_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SessionContext_Done_Call) RunAndReturn(run func() <-chan struct{}) *SessionContext_Done_Call { + _c.Call.Return(run) + return _c +} + // EndSession provides a mock function with given fields: ctx func (_m *SessionContext) EndSession(ctx context.Context) { _m.Called(ctx) } +// SessionContext_EndSession_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EndSession' +type SessionContext_EndSession_Call struct { + *mock.Call +} + +// EndSession is a helper method to define mock.On call +// - ctx context.Context +func (_e *SessionContext_Expecter) EndSession(ctx interface{}) *SessionContext_EndSession_Call { + return &SessionContext_EndSession_Call{Call: _e.mock.On("EndSession", ctx)} +} + +func (_c *SessionContext_EndSession_Call) Run(run func(ctx context.Context)) *SessionContext_EndSession_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *SessionContext_EndSession_Call) Return() *SessionContext_EndSession_Call { + _c.Call.Return() + return _c +} + +func (_c *SessionContext_EndSession_Call) RunAndReturn(run func(context.Context)) *SessionContext_EndSession_Call { + _c.Call.Return(run) + return _c +} + // Err provides a mock function with given fields: func (_m *SessionContext) Err() error { ret := _m.Called() @@ -170,6 +426,33 @@ func (_m *SessionContext) Err() error { return r0 } +// SessionContext_Err_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Err' +type SessionContext_Err_Call struct { + *mock.Call +} + +// Err is a helper method to define mock.On call +func (_e *SessionContext_Expecter) Err() *SessionContext_Err_Call { + return &SessionContext_Err_Call{Call: _e.mock.On("Err")} +} + +func (_c *SessionContext_Err_Call) Run(run func()) *SessionContext_Err_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SessionContext_Err_Call) Return(_a0 error) *SessionContext_Err_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SessionContext_Err_Call) RunAndReturn(run func() error) *SessionContext_Err_Call { + _c.Call.Return(run) + return _c +} + // ID provides a mock function with given fields: func (_m *SessionContext) ID() bson.Raw { ret := _m.Called() @@ -186,6 +469,33 @@ func (_m *SessionContext) ID() bson.Raw { return r0 } +// SessionContext_ID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ID' +type SessionContext_ID_Call struct { + *mock.Call +} + +// ID is a helper method to define mock.On call +func (_e *SessionContext_Expecter) ID() *SessionContext_ID_Call { + return &SessionContext_ID_Call{Call: _e.mock.On("ID")} +} + +func (_c *SessionContext_ID_Call) Run(run func()) *SessionContext_ID_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SessionContext_ID_Call) Return(_a0 bson.Raw) *SessionContext_ID_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SessionContext_ID_Call) RunAndReturn(run func() bson.Raw) *SessionContext_ID_Call { + _c.Call.Return(run) + return _c +} + // OperationTime provides a mock function with given fields: func (_m *SessionContext) OperationTime() *primitive.Timestamp { ret := _m.Called() @@ -202,6 +512,33 @@ func (_m *SessionContext) OperationTime() *primitive.Timestamp { return r0 } +// SessionContext_OperationTime_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OperationTime' +type SessionContext_OperationTime_Call struct { + *mock.Call +} + +// OperationTime is a helper method to define mock.On call +func (_e *SessionContext_Expecter) OperationTime() *SessionContext_OperationTime_Call { + return &SessionContext_OperationTime_Call{Call: _e.mock.On("OperationTime")} +} + +func (_c *SessionContext_OperationTime_Call) Run(run func()) *SessionContext_OperationTime_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SessionContext_OperationTime_Call) Return(_a0 *primitive.Timestamp) *SessionContext_OperationTime_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SessionContext_OperationTime_Call) RunAndReturn(run func() *primitive.Timestamp) *SessionContext_OperationTime_Call { + _c.Call.Return(run) + return _c +} + // StartTransaction provides a mock function with given fields: opts func (_m *SessionContext) StartTransaction(opts ...*options.TransactionOptions) error { _va := make([]interface{}, len(opts)) @@ -222,6 +559,41 @@ func (_m *SessionContext) StartTransaction(opts ...*options.TransactionOptions) return r0 } +// SessionContext_StartTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartTransaction' +type SessionContext_StartTransaction_Call struct { + *mock.Call +} + +// StartTransaction is a helper method to define mock.On call +// - opts ...*options.TransactionOptions +func (_e *SessionContext_Expecter) StartTransaction(opts ...interface{}) *SessionContext_StartTransaction_Call { + return &SessionContext_StartTransaction_Call{Call: _e.mock.On("StartTransaction", + append([]interface{}{}, opts...)...)} +} + +func (_c *SessionContext_StartTransaction_Call) Run(run func(opts ...*options.TransactionOptions)) *SessionContext_StartTransaction_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.TransactionOptions, len(args)-0) + for i, a := range args[0:] { + if a != nil { + variadicArgs[i] = a.(*options.TransactionOptions) + } + } + run(variadicArgs...) + }) + return _c +} + +func (_c *SessionContext_StartTransaction_Call) Return(_a0 error) *SessionContext_StartTransaction_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SessionContext_StartTransaction_Call) RunAndReturn(run func(...*options.TransactionOptions) error) *SessionContext_StartTransaction_Call { + _c.Call.Return(run) + return _c +} + // Value provides a mock function with given fields: key func (_m *SessionContext) Value(key interface{}) interface{} { ret := _m.Called(key) @@ -238,6 +610,34 @@ func (_m *SessionContext) Value(key interface{}) interface{} { return r0 } +// SessionContext_Value_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Value' +type SessionContext_Value_Call struct { + *mock.Call +} + +// Value is a helper method to define mock.On call +// - key interface{} +func (_e *SessionContext_Expecter) Value(key interface{}) *SessionContext_Value_Call { + return &SessionContext_Value_Call{Call: _e.mock.On("Value", key)} +} + +func (_c *SessionContext_Value_Call) Run(run func(key interface{})) *SessionContext_Value_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(interface{})) + }) + return _c +} + +func (_c *SessionContext_Value_Call) Return(_a0 interface{}) *SessionContext_Value_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SessionContext_Value_Call) RunAndReturn(run func(interface{}) interface{}) *SessionContext_Value_Call { + _c.Call.Return(run) + return _c +} + // WithTransaction provides a mock function with given fields: ctx, fn, opts func (_m *SessionContext) WithTransaction(ctx context.Context, fn func(mongoifc.SessionContext) (interface{}, error), opts ...*options.TransactionOptions) (interface{}, error) { _va := make([]interface{}, len(opts)) @@ -271,6 +671,43 @@ func (_m *SessionContext) WithTransaction(ctx context.Context, fn func(mongoifc. return r0, r1 } +// SessionContext_WithTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithTransaction' +type SessionContext_WithTransaction_Call struct { + *mock.Call +} + +// WithTransaction is a helper method to define mock.On call +// - ctx context.Context +// - fn func(mongoifc.SessionContext)(interface{} , error) +// - opts ...*options.TransactionOptions +func (_e *SessionContext_Expecter) WithTransaction(ctx interface{}, fn interface{}, opts ...interface{}) *SessionContext_WithTransaction_Call { + return &SessionContext_WithTransaction_Call{Call: _e.mock.On("WithTransaction", + append([]interface{}{ctx, fn}, opts...)...)} +} + +func (_c *SessionContext_WithTransaction_Call) Run(run func(ctx context.Context, fn func(mongoifc.SessionContext) (interface{}, error), opts ...*options.TransactionOptions)) *SessionContext_WithTransaction_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]*options.TransactionOptions, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(*options.TransactionOptions) + } + } + run(args[0].(context.Context), args[1].(func(mongoifc.SessionContext) (interface{}, error)), variadicArgs...) + }) + return _c +} + +func (_c *SessionContext_WithTransaction_Call) Return(_a0 interface{}, _a1 error) *SessionContext_WithTransaction_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SessionContext_WithTransaction_Call) RunAndReturn(run func(context.Context, func(mongoifc.SessionContext) (interface{}, error), ...*options.TransactionOptions) (interface{}, error)) *SessionContext_WithTransaction_Call { + _c.Call.Return(run) + return _c +} + // NewSessionContext creates a new instance of SessionContext. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewSessionContext(t interface { diff --git a/mocks/mockery/single_result.go b/mocks/mockery/single_result.go index 3b1ea4b..153fbbc 100644 --- a/mocks/mockery/single_result.go +++ b/mocks/mockery/single_result.go @@ -12,6 +12,14 @@ type SingleResult struct { mock.Mock } +type SingleResult_Expecter struct { + mock *mock.Mock +} + +func (_m *SingleResult) EXPECT() *SingleResult_Expecter { + return &SingleResult_Expecter{mock: &_m.Mock} +} + // Decode provides a mock function with given fields: v func (_m *SingleResult) Decode(v interface{}) error { ret := _m.Called(v) @@ -26,6 +34,34 @@ func (_m *SingleResult) Decode(v interface{}) error { return r0 } +// SingleResult_Decode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Decode' +type SingleResult_Decode_Call struct { + *mock.Call +} + +// Decode is a helper method to define mock.On call +// - v interface{} +func (_e *SingleResult_Expecter) Decode(v interface{}) *SingleResult_Decode_Call { + return &SingleResult_Decode_Call{Call: _e.mock.On("Decode", v)} +} + +func (_c *SingleResult_Decode_Call) Run(run func(v interface{})) *SingleResult_Decode_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(interface{})) + }) + return _c +} + +func (_c *SingleResult_Decode_Call) Return(_a0 error) *SingleResult_Decode_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SingleResult_Decode_Call) RunAndReturn(run func(interface{}) error) *SingleResult_Decode_Call { + _c.Call.Return(run) + return _c +} + // DecodeBytes provides a mock function with given fields: func (_m *SingleResult) DecodeBytes() (bson.Raw, error) { ret := _m.Called() @@ -52,6 +88,33 @@ func (_m *SingleResult) DecodeBytes() (bson.Raw, error) { return r0, r1 } +// SingleResult_DecodeBytes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DecodeBytes' +type SingleResult_DecodeBytes_Call struct { + *mock.Call +} + +// DecodeBytes is a helper method to define mock.On call +func (_e *SingleResult_Expecter) DecodeBytes() *SingleResult_DecodeBytes_Call { + return &SingleResult_DecodeBytes_Call{Call: _e.mock.On("DecodeBytes")} +} + +func (_c *SingleResult_DecodeBytes_Call) Run(run func()) *SingleResult_DecodeBytes_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SingleResult_DecodeBytes_Call) Return(_a0 bson.Raw, _a1 error) *SingleResult_DecodeBytes_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SingleResult_DecodeBytes_Call) RunAndReturn(run func() (bson.Raw, error)) *SingleResult_DecodeBytes_Call { + _c.Call.Return(run) + return _c +} + // Err provides a mock function with given fields: func (_m *SingleResult) Err() error { ret := _m.Called() @@ -66,6 +129,33 @@ func (_m *SingleResult) Err() error { return r0 } +// SingleResult_Err_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Err' +type SingleResult_Err_Call struct { + *mock.Call +} + +// Err is a helper method to define mock.On call +func (_e *SingleResult_Expecter) Err() *SingleResult_Err_Call { + return &SingleResult_Err_Call{Call: _e.mock.On("Err")} +} + +func (_c *SingleResult_Err_Call) Run(run func()) *SingleResult_Err_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SingleResult_Err_Call) Return(_a0 error) *SingleResult_Err_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SingleResult_Err_Call) RunAndReturn(run func() error) *SingleResult_Err_Call { + _c.Call.Return(run) + return _c +} + // NewSingleResult creates a new instance of SingleResult. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewSingleResult(t interface {