|
@@ -2295,6 +2295,9 @@ type MockUsersStore struct {
|
|
|
|
|
|
|
|
|
AuthenticateFunc *UsersStoreAuthenticateFunc
|
|
|
+
|
|
|
+
|
|
|
+ CountFunc *UsersStoreCountFunc
|
|
|
|
|
|
|
|
|
CreateFunc *UsersStoreCreateFunc
|
|
@@ -2316,6 +2319,9 @@ type MockUsersStore struct {
|
|
|
|
|
|
|
|
|
IsUsernameUsedFunc *UsersStoreIsUsernameUsedFunc
|
|
|
+
|
|
|
+
|
|
|
+ ListFunc *UsersStoreListFunc
|
|
|
|
|
|
|
|
|
ListFollowersFunc *UsersStoreListFollowersFunc
|
|
@@ -2336,6 +2342,11 @@ func NewMockUsersStore() *MockUsersStore {
|
|
|
return
|
|
|
},
|
|
|
},
|
|
|
+ CountFunc: &UsersStoreCountFunc{
|
|
|
+ defaultHook: func(context.Context) (r0 int64) {
|
|
|
+ return
|
|
|
+ },
|
|
|
+ },
|
|
|
CreateFunc: &UsersStoreCreateFunc{
|
|
|
defaultHook: func(context.Context, string, string, db.CreateUserOptions) (r0 *db.User, r1 error) {
|
|
|
return
|
|
@@ -2371,6 +2382,11 @@ func NewMockUsersStore() *MockUsersStore {
|
|
|
return
|
|
|
},
|
|
|
},
|
|
|
+ ListFunc: &UsersStoreListFunc{
|
|
|
+ defaultHook: func(context.Context, int, int) (r0 []*db.User, r1 error) {
|
|
|
+ return
|
|
|
+ },
|
|
|
+ },
|
|
|
ListFollowersFunc: &UsersStoreListFollowersFunc{
|
|
|
defaultHook: func(context.Context, int64, int, int) (r0 []*db.User, r1 error) {
|
|
|
return
|
|
@@ -2398,6 +2414,11 @@ func NewStrictMockUsersStore() *MockUsersStore {
|
|
|
panic("unexpected invocation of MockUsersStore.Authenticate")
|
|
|
},
|
|
|
},
|
|
|
+ CountFunc: &UsersStoreCountFunc{
|
|
|
+ defaultHook: func(context.Context) int64 {
|
|
|
+ panic("unexpected invocation of MockUsersStore.Count")
|
|
|
+ },
|
|
|
+ },
|
|
|
CreateFunc: &UsersStoreCreateFunc{
|
|
|
defaultHook: func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
|
|
|
panic("unexpected invocation of MockUsersStore.Create")
|
|
@@ -2433,6 +2454,11 @@ func NewStrictMockUsersStore() *MockUsersStore {
|
|
|
panic("unexpected invocation of MockUsersStore.IsUsernameUsed")
|
|
|
},
|
|
|
},
|
|
|
+ ListFunc: &UsersStoreListFunc{
|
|
|
+ defaultHook: func(context.Context, int, int) ([]*db.User, error) {
|
|
|
+ panic("unexpected invocation of MockUsersStore.List")
|
|
|
+ },
|
|
|
+ },
|
|
|
ListFollowersFunc: &UsersStoreListFollowersFunc{
|
|
|
defaultHook: func(context.Context, int64, int, int) ([]*db.User, error) {
|
|
|
panic("unexpected invocation of MockUsersStore.ListFollowers")
|
|
@@ -2458,6 +2484,9 @@ func NewMockUsersStoreFrom(i db.UsersStore) *MockUsersStore {
|
|
|
AuthenticateFunc: &UsersStoreAuthenticateFunc{
|
|
|
defaultHook: i.Authenticate,
|
|
|
},
|
|
|
+ CountFunc: &UsersStoreCountFunc{
|
|
|
+ defaultHook: i.Count,
|
|
|
+ },
|
|
|
CreateFunc: &UsersStoreCreateFunc{
|
|
|
defaultHook: i.Create,
|
|
|
},
|
|
@@ -2479,6 +2508,9 @@ func NewMockUsersStoreFrom(i db.UsersStore) *MockUsersStore {
|
|
|
IsUsernameUsedFunc: &UsersStoreIsUsernameUsedFunc{
|
|
|
defaultHook: i.IsUsernameUsed,
|
|
|
},
|
|
|
+ ListFunc: &UsersStoreListFunc{
|
|
|
+ defaultHook: i.List,
|
|
|
+ },
|
|
|
ListFollowersFunc: &UsersStoreListFollowersFunc{
|
|
|
defaultHook: i.ListFollowers,
|
|
|
},
|
|
@@ -2605,6 +2637,107 @@ func (c UsersStoreAuthenticateFuncCall) Results() []interface{} {
|
|
|
return []interface{}{c.Result0, c.Result1}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+type UsersStoreCountFunc struct {
|
|
|
+ defaultHook func(context.Context) int64
|
|
|
+ hooks []func(context.Context) int64
|
|
|
+ history []UsersStoreCountFuncCall
|
|
|
+ mutex sync.Mutex
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *MockUsersStore) Count(v0 context.Context) int64 {
|
|
|
+ r0 := m.CountFunc.nextHook()(v0)
|
|
|
+ m.CountFunc.appendCall(UsersStoreCountFuncCall{v0, r0})
|
|
|
+ return r0
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *UsersStoreCountFunc) SetDefaultHook(hook func(context.Context) int64) {
|
|
|
+ f.defaultHook = hook
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *UsersStoreCountFunc) PushHook(hook func(context.Context) int64) {
|
|
|
+ f.mutex.Lock()
|
|
|
+ f.hooks = append(f.hooks, hook)
|
|
|
+ f.mutex.Unlock()
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *UsersStoreCountFunc) SetDefaultReturn(r0 int64) {
|
|
|
+ f.SetDefaultHook(func(context.Context) int64 {
|
|
|
+ return r0
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (f *UsersStoreCountFunc) PushReturn(r0 int64) {
|
|
|
+ f.PushHook(func(context.Context) int64 {
|
|
|
+ return r0
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+func (f *UsersStoreCountFunc) nextHook() func(context.Context) int64 {
|
|
|
+ f.mutex.Lock()
|
|
|
+ defer f.mutex.Unlock()
|
|
|
+
|
|
|
+ if len(f.hooks) == 0 {
|
|
|
+ return f.defaultHook
|
|
|
+ }
|
|
|
+
|
|
|
+ hook := f.hooks[0]
|
|
|
+ f.hooks = f.hooks[1:]
|
|
|
+ return hook
|
|
|
+}
|
|
|
+
|
|
|
+func (f *UsersStoreCountFunc) appendCall(r0 UsersStoreCountFuncCall) {
|
|
|
+ f.mutex.Lock()
|
|
|
+ f.history = append(f.history, r0)
|
|
|
+ f.mutex.Unlock()
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *UsersStoreCountFunc) History() []UsersStoreCountFuncCall {
|
|
|
+ f.mutex.Lock()
|
|
|
+ history := make([]UsersStoreCountFuncCall, len(f.history))
|
|
|
+ copy(history, f.history)
|
|
|
+ f.mutex.Unlock()
|
|
|
+
|
|
|
+ return history
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+type UsersStoreCountFuncCall struct {
|
|
|
+
|
|
|
+
|
|
|
+ Arg0 context.Context
|
|
|
+
|
|
|
+
|
|
|
+ Result0 int64
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (c UsersStoreCountFuncCall) Args() []interface{} {
|
|
|
+ return []interface{}{c.Arg0}
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (c UsersStoreCountFuncCall) Results() []interface{} {
|
|
|
+ return []interface{}{c.Result0}
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
|
|
|
type UsersStoreCreateFunc struct {
|
|
@@ -3363,6 +3496,116 @@ func (c UsersStoreIsUsernameUsedFuncCall) Results() []interface{} {
|
|
|
return []interface{}{c.Result0}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+type UsersStoreListFunc struct {
|
|
|
+ defaultHook func(context.Context, int, int) ([]*db.User, error)
|
|
|
+ hooks []func(context.Context, int, int) ([]*db.User, error)
|
|
|
+ history []UsersStoreListFuncCall
|
|
|
+ mutex sync.Mutex
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (m *MockUsersStore) List(v0 context.Context, v1 int, v2 int) ([]*db.User, error) {
|
|
|
+ r0, r1 := m.ListFunc.nextHook()(v0, v1, v2)
|
|
|
+ m.ListFunc.appendCall(UsersStoreListFuncCall{v0, v1, v2, r0, r1})
|
|
|
+ return r0, r1
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *UsersStoreListFunc) SetDefaultHook(hook func(context.Context, int, int) ([]*db.User, error)) {
|
|
|
+ f.defaultHook = hook
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *UsersStoreListFunc) PushHook(hook func(context.Context, int, int) ([]*db.User, error)) {
|
|
|
+ f.mutex.Lock()
|
|
|
+ f.hooks = append(f.hooks, hook)
|
|
|
+ f.mutex.Unlock()
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *UsersStoreListFunc) SetDefaultReturn(r0 []*db.User, r1 error) {
|
|
|
+ f.SetDefaultHook(func(context.Context, int, int) ([]*db.User, error) {
|
|
|
+ return r0, r1
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func (f *UsersStoreListFunc) PushReturn(r0 []*db.User, r1 error) {
|
|
|
+ f.PushHook(func(context.Context, int, int) ([]*db.User, error) {
|
|
|
+ return r0, r1
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+func (f *UsersStoreListFunc) nextHook() func(context.Context, int, int) ([]*db.User, error) {
|
|
|
+ f.mutex.Lock()
|
|
|
+ defer f.mutex.Unlock()
|
|
|
+
|
|
|
+ if len(f.hooks) == 0 {
|
|
|
+ return f.defaultHook
|
|
|
+ }
|
|
|
+
|
|
|
+ hook := f.hooks[0]
|
|
|
+ f.hooks = f.hooks[1:]
|
|
|
+ return hook
|
|
|
+}
|
|
|
+
|
|
|
+func (f *UsersStoreListFunc) appendCall(r0 UsersStoreListFuncCall) {
|
|
|
+ f.mutex.Lock()
|
|
|
+ f.history = append(f.history, r0)
|
|
|
+ f.mutex.Unlock()
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (f *UsersStoreListFunc) History() []UsersStoreListFuncCall {
|
|
|
+ f.mutex.Lock()
|
|
|
+ history := make([]UsersStoreListFuncCall, len(f.history))
|
|
|
+ copy(history, f.history)
|
|
|
+ f.mutex.Unlock()
|
|
|
+
|
|
|
+ return history
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+type UsersStoreListFuncCall struct {
|
|
|
+
|
|
|
+
|
|
|
+ Arg0 context.Context
|
|
|
+
|
|
|
+
|
|
|
+ Arg1 int
|
|
|
+
|
|
|
+
|
|
|
+ Arg2 int
|
|
|
+
|
|
|
+
|
|
|
+ Result0 []*db.User
|
|
|
+
|
|
|
+
|
|
|
+ Result1 error
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (c UsersStoreListFuncCall) Args() []interface{} {
|
|
|
+ return []interface{}{c.Arg0, c.Arg1, c.Arg2}
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (c UsersStoreListFuncCall) Results() []interface{} {
|
|
|
+ return []interface{}{c.Result0, c.Result1}
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
|
|
|
type UsersStoreListFollowersFunc struct {
|