using System; using System.Linq; using Jellyfin.Database.Implementations.MatchCriteria; namespace Jellyfin.Database.Implementations; /// /// Provider interface for descendant queries using recursive CTEs. /// Each database provider implements this with provider-specific SQL. /// public interface IDescendantQueryProvider { /// /// Gets a queryable of all descendant IDs for a parent item. /// Uses recursive CTE to traverse AncestorIds and LinkedChildren infinitely. /// /// Database context. /// Parent item ID. /// Queryable of descendant item IDs. IQueryable GetAllDescendantIds(JellyfinDbContext context, Guid parentId); /// /// Gets a queryable of all folder IDs that have any descendant matching the specified criteria. /// Uses recursive CTE for infinite depth traversal. Can be used in LINQ .Contains() expressions. /// /// Database context. /// The matching criteria to apply. /// Queryable of folder IDs. IQueryable GetFolderIdsMatching(JellyfinDbContext context, FolderMatchCriteria criteria); }