From 67d2e4ebcbfb5a85d11383a3de3fcbd2122f9d72 Mon Sep 17 00:00:00 2001 From: Steven Date: Fri, 27 Oct 2023 08:36:43 +0800 Subject: [PATCH] chore: update method name --- store/activity.go | 2 +- store/db/mysql/inbox.go | 2 +- store/db/sqlite/inbox.go | 2 +- store/driver.go | 2 +- store/inbox.go | 4 ++-- test/store/inbox_test.go | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/store/activity.go b/store/activity.go index fa5c55dc..e6c630d7 100644 --- a/store/activity.go +++ b/store/activity.go @@ -25,6 +25,6 @@ func (s *Store) CreateActivity(ctx context.Context, create *Activity) (*Activity return s.driver.CreateActivity(ctx, create) } -func (s *Store) ListActivity(ctx context.Context, find *FindActivity) ([]*Activity, error) { +func (s *Store) ListActivities(ctx context.Context, find *FindActivity) ([]*Activity, error) { return s.driver.ListActivities(ctx, find) } diff --git a/store/db/mysql/inbox.go b/store/db/mysql/inbox.go index 10be4278..6c4fa65e 100644 --- a/store/db/mysql/inbox.go +++ b/store/db/mysql/inbox.go @@ -12,7 +12,7 @@ func (d *DB) CreateInbox(ctx context.Context, create *store.Inbox) (*store.Inbox } // nolint -func (d *DB) ListInboxes(ctx context.Context, find *store.FindInbox) ([]*store.Inbox, error) { +func (d *DB) ListInbox(ctx context.Context, find *store.FindInbox) ([]*store.Inbox, error) { return nil, nil } diff --git a/store/db/sqlite/inbox.go b/store/db/sqlite/inbox.go index bb99e91a..1b0e6e09 100644 --- a/store/db/sqlite/inbox.go +++ b/store/db/sqlite/inbox.go @@ -36,7 +36,7 @@ func (d *DB) CreateInbox(ctx context.Context, create *store.Inbox) (*store.Inbox return create, nil } -func (d *DB) ListInboxes(ctx context.Context, find *store.FindInbox) ([]*store.Inbox, error) { +func (d *DB) ListInbox(ctx context.Context, find *store.FindInbox) ([]*store.Inbox, error) { where, args := []string{"1 = 1"}, []any{} if find.ID != nil { diff --git a/store/driver.go b/store/driver.go index f434fecb..d05ed1c2 100644 --- a/store/driver.go +++ b/store/driver.go @@ -84,7 +84,7 @@ type Driver interface { // Inbox model related methods. CreateInbox(ctx context.Context, create *Inbox) (*Inbox, error) - ListInboxes(ctx context.Context, find *FindInbox) ([]*Inbox, error) + ListInbox(ctx context.Context, find *FindInbox) ([]*Inbox, error) UpdateInbox(ctx context.Context, update *UpdateInbox) (*Inbox, error) DeleteInbox(ctx context.Context, delete *DeleteInbox) error } diff --git a/store/inbox.go b/store/inbox.go index fd3e4071..e94cbae9 100644 --- a/store/inbox.go +++ b/store/inbox.go @@ -44,8 +44,8 @@ func (s *Store) CreateInbox(ctx context.Context, create *Inbox) (*Inbox, error) return s.driver.CreateInbox(ctx, create) } -func (s *Store) ListInboxes(ctx context.Context, find *FindInbox) ([]*Inbox, error) { - return s.driver.ListInboxes(ctx, find) +func (s *Store) ListInbox(ctx context.Context, find *FindInbox) ([]*Inbox, error) { + return s.driver.ListInbox(ctx, find) } func (s *Store) UpdateInbox(ctx context.Context, update *UpdateInbox) (*Inbox, error) { diff --git a/test/store/inbox_test.go b/test/store/inbox_test.go index 11f07322..5c4dbc48 100644 --- a/test/store/inbox_test.go +++ b/test/store/inbox_test.go @@ -30,7 +30,7 @@ func TestInboxStore(t *testing.T) { require.NoError(t, err) require.NotNil(t, inbox) require.Equal(t, create.Message, inbox.Message) - inboxes, err := ts.ListInboxes(ctx, &store.FindInbox{ + inboxes, err := ts.ListInbox(ctx, &store.FindInbox{ ReceiverID: &user.ID, }) require.NoError(t, err) @@ -47,7 +47,7 @@ func TestInboxStore(t *testing.T) { ID: inbox.ID, }) require.NoError(t, err) - inboxes, err = ts.ListInboxes(ctx, &store.FindInbox{ + inboxes, err = ts.ListInbox(ctx, &store.FindInbox{ ReceiverID: &user.ID, }) require.NoError(t, err)