From 55296d9a95b6ca4de03f12e99e2a215dc43ed6e2 Mon Sep 17 00:00:00 2001 From: soxx Date: Sat, 22 Jun 2024 22:30:03 +0200 Subject: [PATCH] refactor(postgres): renamed functions to be more clear Signed-off-by: soxx --- pkg/database/database.go | 6 +++--- pkg/database/postgres.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/database/database.go b/pkg/database/database.go index 7977186..bc31c17 100644 --- a/pkg/database/database.go +++ b/pkg/database/database.go @@ -22,11 +22,11 @@ type OtterSpace interface { CheckUserPostLink(ctx context.Context, anthroveUserID models.AnthroveUserID, sourcePostID string, sourceUrl string) (bool, error) - CheckPostNodeExistsByAnthroveID(ctx context.Context, anthrovePost *models.Post) (*models.Post, error) + GetPostByAnthroveID(ctx context.Context, anthrovePost *models.Post) (*models.Post, error) - CheckPostNodeExistsBySourceURL(ctx context.Context, sourceUrl string) (*models.Post, error) + GetPostBySourceURL(ctx context.Context, sourceUrl string) (*models.Post, error) - CheckPostNodeExistsBySourceID(ctx context.Context, sourcePostID string) (*models.Post, error) + GetPostBySourceID(ctx context.Context, sourcePostID string) (*models.Post, error) GetUserFavoriteCount(ctx context.Context, anthroveUserID models.AnthroveUserID) (int64, error) diff --git a/pkg/database/postgres.go b/pkg/database/postgres.go index d91f57a..f4a2750 100644 --- a/pkg/database/postgres.go +++ b/pkg/database/postgres.go @@ -92,15 +92,15 @@ func (p *postgresqlConnection) CheckUserPostLink(ctx context.Context, anthroveUs return postgres.CheckUserToPostLink(ctx, p.db, anthroveUserID, models.AnthrovePostID(sourcePostID)) } -func (p *postgresqlConnection) CheckPostNodeExistsByAnthroveID(ctx context.Context, anthrovePost *models.Post) (*models.Post, error) { +func (p *postgresqlConnection) GetPostByAnthroveID(ctx context.Context, anthrovePost *models.Post) (*models.Post, error) { return postgres.GetPostByAnthroveID(ctx, p.db, anthrovePost.ID) } -func (p *postgresqlConnection) CheckPostNodeExistsBySourceURL(ctx context.Context, sourceUrl string) (*models.Post, error) { +func (p *postgresqlConnection) GetPostBySourceURL(ctx context.Context, sourceUrl string) (*models.Post, error) { return postgres.GetPostBySourceURL(ctx, p.db, sourceUrl) } -func (p *postgresqlConnection) CheckPostNodeExistsBySourceID(ctx context.Context, sourcePostID string) (*models.Post, error) { +func (p *postgresqlConnection) GetPostBySourceID(ctx context.Context, sourcePostID string) (*models.Post, error) { return postgres.GetPostBySourceID(ctx, p.db, sourcePostID) }