public/Get-RecipeStat.ps1

function Get-RecipeStat {
    [CmdletBinding()]
    param()

    $row = Invoke-RecipeDbQuery -Query @"
SELECT
    (SELECT COUNT(*) FROM Recipes) AS RecipeCount,
    (SELECT COUNT(*) FROM Recipes WHERE IsFavorite = 1) AS FavoriteCount,
    (SELECT COUNT(*) FROM Tags) AS TagCount;
"@


    if (-not $row) {
        return [pscustomobject]@{ RecipeCount = 0; FavoriteCount = 0; TagCount = 0 }
    }

    return [pscustomobject]@{
        RecipeCount    = [int]$row.RecipeCount
        FavoriteCount  = [int]$row.FavoriteCount
        TagCount       = [int]$row.TagCount
    }
}