feat(postgres): added new each function
Signed-off-by: soxx <soxx@fenpa.ws>
This commit is contained in:
parent
d4bec1d8c7
commit
795bcbdac3
@ -39,7 +39,14 @@ func CheckIfAnthrovePostNodeExistsByAnthroveID(ctx context.Context, db *gorm.DB,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func CheckIfAnthrovePostNodeExistsBySourceURL(ctx context.Context, db *gorm.DB, sourceURL string) (bool, error) {
|
func CheckIfAnthrovePostNodeExistsBySourceURL(ctx context.Context, db *gorm.DB, sourceURL string) (bool, error) {
|
||||||
return executeCheckQuery(ctx, db, "url = ?", sourceURL)
|
var size int64
|
||||||
|
err := db.WithContext(ctx).Model(&pgModels.PostReference{}).Where("url = ?", sourceURL).Count(&size).Error
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return size > 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func CheckIfAnthrovePostNodeExistsBySourceID(ctx context.Context, db *gorm.DB, sourceID string) (bool, error) {
|
func CheckIfAnthrovePostNodeExistsBySourceID(ctx context.Context, db *gorm.DB, sourceID string) (bool, error) {
|
||||||
|
Reference in New Issue
Block a user