summaryrefslogtreecommitdiff
path: root/internal/db/statusfave.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-08-04 12:28:33 +0100
committerLibravatar GitHub <noreply@github.com>2023-08-04 12:28:33 +0100
commit9a291dea843448f78b4b98ea6813739aebe708c6 (patch)
treef1ce643a3c9fe1b13e4c107f15b1ac4b20fe5b86 /internal/db/statusfave.go
parent[feature] simpler cache size configuration (#2051) (diff)
downloadgotosocial-9a291dea843448f78b4b98ea6813739aebe708c6.tar.xz
[performance] add caching of status fave, boost of, in reply to ID lists (#2060)
Diffstat (limited to 'internal/db/statusfave.go')
-rw-r--r--internal/db/statusfave.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/internal/db/statusfave.go b/internal/db/statusfave.go
index 37769ff79..343a80caa 100644
--- a/internal/db/statusfave.go
+++ b/internal/db/statusfave.go
@@ -24,16 +24,15 @@ import (
)
type StatusFave interface {
- // GetStatusFaveByAccountID gets one status fave created by the given
- // accountID, targeting the given statusID.
+ // GetStatusFaveByAccountID gets one status fave created by the given accountID, targeting the given statusID.
GetStatusFave(ctx context.Context, accountID string, statusID string) (*gtsmodel.StatusFave, error)
// GetStatusFave returns one status fave with the given id.
GetStatusFaveByID(ctx context.Context, id string) (*gtsmodel.StatusFave, error)
- // GetStatusFaves returns a slice of faves/likes of the given status.
+ // GetStatusFaves returns a slice of faves/likes of the status with given ID.
// This slice will be unfiltered, not taking account of blocks and whatnot, so filter it before serving it back to a user.
- GetStatusFavesForStatus(ctx context.Context, statusID string) ([]*gtsmodel.StatusFave, error)
+ GetStatusFaves(ctx context.Context, statusID string) ([]*gtsmodel.StatusFave, error)
// PopulateStatusFave ensures that all sub-models of a fave are populated (account, status, etc).
PopulateStatusFave(ctx context.Context, statusFave *gtsmodel.StatusFave) error
@@ -59,8 +58,13 @@ type StatusFave interface {
// At least one parameter must not be an empty string.
DeleteStatusFaves(ctx context.Context, targetAccountID string, originAccountID string) error
- // DeleteStatusFavesForStatus deletes all status faves that target the
- // given status ID. This is useful when a status has been deleted, and you need
- // to clean up after it.
+ // DeleteStatusFavesForStatus deletes all status faves that target the given status ID.
+ // This is useful when a status has been deleted, and you need to clean up after it.
DeleteStatusFavesForStatus(ctx context.Context, statusID string) error
+
+ // CountStatusFaves returns the number of status favourites registered for status with ID.
+ CountStatusFaves(ctx context.Context, statusID string) (int, error)
+
+ // IsStatusFavedBy returns whether the status with ID has been favourited by account with ID.
+ IsStatusFavedBy(ctx context.Context, statusID string, accountID string) (bool, error)
}